pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
Hi, Last line in the code is where i need help...
After finding and setting found adderss as address i want vba to select that range and copy it to sheet2.range("A1") as values.
Thanks alot for helping
After finding and setting found adderss as address i want vba to select that range and copy it to sheet2.range("A1") as values.
Thanks alot for helping
Code:
[/FONT]
[FONT=Courier New]Dim startdate As String
Dim enddate As String
Dim myfirstadd, mysecondadd As String[/FONT]
[FONT=Courier New]startdate = Me.DTPicker1.Value
enddate = Me.DTPicker2.Value[/FONT]
[FONT=Courier New]Dim c As Range
With Sheet1.Range("a1:as1")
Set c = .Find(startdate, LookIn:=xlValues)
If c Is Nothing Then
MsgBox startdate & " not found"
Exit Sub
Else
myfirstadd = c.Address
End If
End With[/FONT]
[FONT=Courier New]With Sheet1.Range("a1:as1")
Set c = .Find(enddate, LookIn:=xlValues)
If c Is Nothing Then
MsgBox startdate & " not found"
Exit Sub
Else
mysecondadd = c.Address
End If
End With[/FONT]
[FONT=Courier New]dim lr as long[/FONT]
[FONT=Courier New]lr = Sheet1.Range("A" & Rows.Count).End(xlUp).Row[/FONT]
[FONT=Courier New][B]Range(myfirstadd & ":" & mysecondadd & Lr).Select[/B][/FONT]
[FONT=Courier New]