Copy Macro
Posted by Andonny on January 31, 2001 3:05 AM
Hi,
I would like to achieve with the code below that O_start and O_end are declared the correct way and then I would like to use them in the two lines below correctly.
(What:="O_start", After:=.Cells(1, 1)).Row
(What:="O_end", After:=.Cells(1, 1)).Row
Thank you very much for your help in advance
Andonny
Below is the whole macro:
Sub Copy()
Dim mysheet As Worksheet
Set mysheet = ActiveSheet
Dim Area2St As String, Area2Fn As String
Dim O_start As String
Dim O_end As String
O_start = mystring.Range("Q16")
O_end = mystring.Range("Q17")
With Sheets("Sheet1").Cells
' starts copying at Area2St = "A" where A represents column A
Area2St = "A" & .Find _
(What:="O_start", After:=.Cells(1, 1)).Row
' Copies up to Area2Fn = "G" where G represents column G
Area2Fn = "R" & .Find _
(What:="O_end", After:=.Cells(1, 1)).Row
.Range(Area2St & ":" & Area2Fn).Copy _
mysheet.Range("A2")
End With
End Sub