|First a posting tip:|
Please click on my signature line at the bottom of this post and read the instructions on how to post VBA code in this forum so that it is easier for us to read.
In addition, you might want to check out this How-To as a means to help you troubleshoot your code:
As for one of your questions, this line fails because the syntax is wrong:
Since C1, R1, etc. are integers, you should use the Cells method to refer to the Range:
Range(Cells(R1, C1), Cells(R2, C2)).Select
Finally, I would use the .Find method to directly find the dates instead of looping through Column A. I would also use the Application.InputBox method instead of just InputBox since that will allow you click on the date cell instead of manually entering it. A manual entry will still work assuming the user doesn't make a typing mistake, but clicking the desired cell is much safer. The code below should work regardless of which date you enter/select first.
This code is pretty basic, with no error checking, etc. but it seems to get the job done.
Dim D1 As Date, D2 As Date
Dim startDate As Range, endDate As Range
'Get Start date from user
D1 = Application.InputBox("Enter Start date")
'Get End Date from user
D2 = Application.InputBox("Enter End date")
'Find dates in Column A
Set startDate = .Find(D1)
Set endDate = .Find(D2)
'Select the range
Range(startDate.Address & ":" & _
Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.
message edited by DerbyDad03