C
Cat
Hello.
I would like to search the data which reside on a specific column of a
worksheet. The problem is, that the data don't start from the first
row. I created a simplified vba for illustration purposes. The code
draws a box on the region I want to search. PLEASE NOTE THAT THE CODE
IS NOT THE ACTUAL CODE, but a simplified demo code.
Sub Button1_Click()
Const dataColumn As String = "C"
Const dataStarts As Integer = 4
Dim allData As Range
Dim sheet As Worksheet
Set sheet = ActiveSheet
Set allData = sheet.Columns(dataColumn)
Set allData = allData.Offset(dataStarts, 0) <===== RUN ERROR 1004!
Without this line, it will search from the first row.
allData.Cells.BorderAround XlLineStyle.xlContinuous
End Sub
The error message is "Application-defined or object-defined error" and
the help in Excel wasn't much helpful. Basically, I want to start
searching from the "dataStarts" row not from the first row.
What is wrong with my code? Thank you for any hints.
I would like to search the data which reside on a specific column of a
worksheet. The problem is, that the data don't start from the first
row. I created a simplified vba for illustration purposes. The code
draws a box on the region I want to search. PLEASE NOTE THAT THE CODE
IS NOT THE ACTUAL CODE, but a simplified demo code.
Sub Button1_Click()
Const dataColumn As String = "C"
Const dataStarts As Integer = 4
Dim allData As Range
Dim sheet As Worksheet
Set sheet = ActiveSheet
Set allData = sheet.Columns(dataColumn)
Set allData = allData.Offset(dataStarts, 0) <===== RUN ERROR 1004!
Without this line, it will search from the first row.
allData.Cells.BorderAround XlLineStyle.xlContinuous
End Sub
The error message is "Application-defined or object-defined error" and
the help in Excel wasn't much helpful. Basically, I want to start
searching from the "dataStarts" row not from the first row.
What is wrong with my code? Thank you for any hints.