Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 didnt 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("TripDa te: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 dont go as planned Cells(iNextRow, 1) = TBDate.Value Cells(iNextRow, 2) = CBCaptain.Valu Cells(iNextRow, 3) = TBFirstOfficer.Valu Thank Ski |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
refering to other workbooks | Excel Discussion (Misc queries) | |||
Refering to other tabs easily | Excel Discussion (Misc queries) | |||
Refering a cell | Excel Worksheet Functions | |||
Refering to Cells | Excel Worksheet Functions | |||
Refering to Cell's Name in Macro | Excel Programming |