The code continues beyond what I put in here but it is not important. When the code reaches the dataobj.range line of code, I get this error. Any ideas why it is happening?
Sub stacknew()
Dim dataobj As Object
Dim start
Dim newstart
Dim finish
Dim stackx
Dim X As Double
Dim c As Double
Dim i As Double
Dim keepx
Dim nsheet
Dim Data As String
'printobj.Activate
Set dataobj = ActiveWorkbook.ActiveSheet
'goes to the specified subroutines and identifies the last row and column in the sheet
X = lastrowN()
c = lastcolN()
'This loop is designed to be flexible with changes to the columns leading the raw data.
'So that the leadig column is always the column with the "SD-1" header
Data = "SD-1"
start = 1
'For p = 1 To c
' If dataobj.Cells(1, p) <> Data Then p = p + 1
dataobj.Range(Cells(1, 1), Cells(1, c)).Find("SD-1", LookIn:=xlFormulas, LookAt:=xlWhole).Activate
If Err.Number = 0 Then
FTemp = dataobj.Cells(ActiveCell.Row, DataCol).Address
Else
FTemp = "???"
End If
Sub stacknew()
Dim dataobj As Object
Dim start
Dim newstart
Dim finish
Dim stackx
Dim X As Double
Dim c As Double
Dim i As Double
Dim keepx
Dim nsheet
Dim Data As String
'printobj.Activate
Set dataobj = ActiveWorkbook.ActiveSheet
'goes to the specified subroutines and identifies the last row and column in the sheet
X = lastrowN()
c = lastcolN()
'This loop is designed to be flexible with changes to the columns leading the raw data.
'So that the leadig column is always the column with the "SD-1" header
Data = "SD-1"
start = 1
'For p = 1 To c
' If dataobj.Cells(1, p) <> Data Then p = p + 1
dataobj.Range(Cells(1, 1), Cells(1, c)).Find("SD-1", LookIn:=xlFormulas, LookAt:=xlWhole).Activate
If Err.Number = 0 Then
FTemp = dataobj.Cells(ActiveCell.Row, DataCol).Address
Else
FTemp = "???"
End If