Hi Everyone,
I have created the below code and a user defined function to-
- To specify the range of cells based on the input dates -->sdate and edate variable
-Run the user defined function searchcolumns based on input of range
Below is the code
Private Sub CommandButton2_Click()
Dim rstr, rend, sdate, edate As Long
Dim ws, rng As String
ws = Sheets("BG").range("J2").Value
sdate = Sheets("BG").range("J3").Value
edate = Sheets("BG").range("J4").Value
rstr = Application.WorksheetFunction.Match(sdate, Sheets(ws).range("$A:$A"), 0)
rend = Application.WorksheetFunction.Match(edate, Sheets(ws).range("$A:$A"), 0)
Let rng = "C" & rstr & ":" & "W" & rend
Sheets("BG").range("J5").Value = SearchColumns(Sheets(ws).range(rng), ",")
End Sub
I am getting Run time error: 1004 with rstr. I think then I also might get this at rend
Can anyone tellme what to do next so that I resolve it?
I have created the below code and a user defined function to-
- To specify the range of cells based on the input dates -->sdate and edate variable
-Run the user defined function searchcolumns based on input of range
Below is the code
Private Sub CommandButton2_Click()
Dim rstr, rend, sdate, edate As Long
Dim ws, rng As String
ws = Sheets("BG").range("J2").Value
sdate = Sheets("BG").range("J3").Value
edate = Sheets("BG").range("J4").Value
rstr = Application.WorksheetFunction.Match(sdate, Sheets(ws).range("$A:$A"), 0)
rend = Application.WorksheetFunction.Match(edate, Sheets(ws).range("$A:$A"), 0)
Let rng = "C" & rstr & ":" & "W" & rend
Sheets("BG").range("J5").Value = SearchColumns(Sheets(ws).range(rng), ",")
End Sub
I am getting Run time error: 1004 with rstr. I think then I also might get this at rend
Can anyone tellme what to do next so that I resolve it?