G
Guest
I am having a bad time incorporating column names in my code. I have named the columns in the spreadsheet. When I attempt to reference those column names in my code I get error codes of data type mismatch. Am using 2003
It worked great in the WorksheetFunction CountA(Range("TripDate:TripDate")
I changed TBDate.Value to TBDate..text, that didn’t work. Formatted the column in several different formats, none worked
Can someone tell me how to refer to columns by name in Cells(Row variable, Column Name)??
The procedure I am trying to write is as follows
Dim iNextRow As Intege
iNextRow =
' Next row in sequence to accept new data
XXX NOTE: This statement worked fine
iNextRow = Application.WorksheetFunction.CountA(Range("TripDate:TripDate")) +
XXX NOTE: I want to refer to column 1 by the name assigned to it “TripDateâ€. When I do that I get a data type mismatch error. None of the below work
Cells(iNextRow, “TripDateâ€) = TBDate.Value This produces an error
Cells(iNextRow, “TripDate:TripDateâ€) = TBDate.Value This produces an error
XXX Obviously the below works, however if the user adds a column things don’t go as planned
Cells(iNextRow, 1) = TBDate.Value
Cells(iNextRow, 2) = CBCaptain.Valu
Cells(iNextRow, 3) = TBFirstOfficer.Valu
Thank
Ski
It worked great in the WorksheetFunction CountA(Range("TripDate:TripDate")
I changed TBDate.Value to TBDate..text, that didn’t work. Formatted the column in several different formats, none worked
Can someone tell me how to refer to columns by name in Cells(Row variable, Column Name)??
The procedure I am trying to write is as follows
Dim iNextRow As Intege
iNextRow =
' Next row in sequence to accept new data
XXX NOTE: This statement worked fine
iNextRow = Application.WorksheetFunction.CountA(Range("TripDate:TripDate")) +
XXX NOTE: I want to refer to column 1 by the name assigned to it “TripDateâ€. When I do that I get a data type mismatch error. None of the below work
Cells(iNextRow, “TripDateâ€) = TBDate.Value This produces an error
Cells(iNextRow, “TripDate:TripDateâ€) = TBDate.Value This produces an error
XXX Obviously the below works, however if the user adds a column things don’t go as planned
Cells(iNextRow, 1) = TBDate.Value
Cells(iNextRow, 2) = CBCaptain.Valu
Cells(iNextRow, 3) = TBFirstOfficer.Valu
Thank
Ski