VB程序员博客
在excel表中怎样编写一个vb小程序实现从一个sheet的单元格的内容拷贝到另一个sheet的单元各种?请大家帮帮忙,多谢哦!我又改写了一下小程序,但实现不了i=4时将单元格的数据复制啊?为什么?是循环语句错了吗?代码如下:
Private Sub CommandButton1_Click()
'Set xlbooks = Workbooks.Open("C:Documents and SettingsAdministrator桌面\Li Ling新建文件夹\GUI080710.xls")
Dim Sheet1 As Worksheet
Dim Sheet2 As Worksheet
Dim b, i
Set Sheet1 = Sheets("CompanyList")
Set Sheet2 = Sheets("International")
i = 3
'a = Sheet1.Cells(2, i)
b = Sheet2.Cells(9, 3)
Do While b = Sheet1.Cells(2, i)
i = i + 1
'If b > Sheet1.Cells(2, i) And b < Sheet1.Cells(2, i) Then Exit Do
'Exit Do
Loop
'Sub Copy()
Sheet2.Cells(9, 3).Value = Sheet1.Cells(2, i).Value
Sheet2.Cells(10, 3).Value = Sheet1.Cells(4, i).Value
Sheet2.Cells(11, 3).Value = Sheet1.Cells(5, i).Value
Sheet2.Cells(12, 3).Value = Sheet1.Cells(6, i).Value
Sheet2.Cells(13, 3).Value = Sheet1.Cells(7, i).Value
Sheet2.Cells(14, 3).Value = Sheet1.Cells(8, i).Value
Sheet2.Cells(21, 3).Value = Sheet1.Cells(10, i).Value
Sheet2.Cells(22, 3).Value = Sheet1.Cells(11, i).Value
Sheet2.Cells(23, 3).Value = Sheet1.Cells(9, i).Value
'End Sub
End Sub
急!请大家帮帮忙!!!!!!
就是不知啊,能否相告啊?多谢!
都是在EXCEL中的操作,干嘛用VB呀,用VBA不是更省事吗?