答案 0 :(得分:2)
尝试以下代码
Public Sub program()
Dim i As Long
Dim j As Long
i = 1
j = 1
Do While Cells(i, "A").Value <> ""
Cells(j, "C").Value = Cells(i, "A").Value
j = j + 1
Cells(j, "C").Value = Cells(i, "B").Value
i = i + 1
j = j + 1
Loop
End Sub
答案 1 :(得分:0)
使用公式string connectionString = "Data Source=localhost\\SqlExpress;" +
"Initial Catalog=MMABooks;Integrated Security=True";
SqlConnection connection = new SqlConnection(connectionString);
string selectStatement = "SELECT Customers.Name, Customers.City, States.StateName " +
"FROM Customers " +
"INNER JOIN States " +
"ON Customers.State = States.StateCode " +
"WHERE Name LIKE @Name";
SqlCommand SelectCommand = new SqlCommand(selectStatement, connection);
SelectCommand.Parameters.AddWithValue("@Name", TextBox1.Text.Trim() + "%");
connection.Open();
var dataAdapter = new SqlDataAdapter(SelectCommand);
DataTable dt = new DataTable();
dataAdapter.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();//you are missing this
执行此操作。只需将其放在=IF(MOD(ROW();2)=1;INDEX(A:B;(1+ROW())/2;1);INDEX(A:B;ROW()/2;2))
上并拖动即可。
答案 2 :(得分:-2)
复制并粘贴特殊 - 粘贴到单元格C1,勾选转置框
快捷方式:Ctrl + C(一起)然后Alt,E,S,E(连续)