Se siete alla ricerca per l'ultima riga di una colonna, utilizzare:
Sub SelectFirstColumn()
SelectEntireColumn (1)
End Sub
Sub SelectSecondColumn()
SelectEntireColumn (2)
End Sub
Sub SelectEntireColumn(columnNumber)
Dim LastRow
Sheets("sheet1").Select
LastRow = ActiveSheet.Columns(columnNumber).SpecialCells(xlLastCell).Row
ActiveSheet.Range(Cells(1, columnNumber), Cells(LastRow, columnNumber)).Select
End Sub
Altri comandi è necessario acquisire familiarità con sono di copia e incolla comandi:
Sub CopyOneToTwo()
SelectEntireColumn (1)
Selection.Copy
Sheets("sheet1").Select
ActiveSheet.Range("B1").PasteSpecial Paste:=xlPasteValues
End Sub
Infine, può fare riferimento a fogli di lavoro in altre cartelle di lavoro utilizzando la seguente sintassi:
Dim book2
Set book2 = Workbooks.Open("C:\book2.xls")
book2.Worksheets("sheet1")
fonte
2009-05-04 19:18:53
Quale programma stai usando: Excel o Access? Il titolo della tua domanda dice Excel, ma i tuoi tag dicono Access. –
Definitivamente Excel, grazie per averlo indicato. Questo è il motivo per cui non si etichetta in fretta. –