LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code refering to columns by name

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
refering to other workbooks cjbarron5 Excel Discussion (Misc queries) 2 June 2nd 08 08:17 PM
Refering to other tabs easily Sean Excel Discussion (Misc queries) 11 November 23rd 07 03:46 AM
Refering a cell Arun Kumar Saha Excel Worksheet Functions 2 June 18th 07 12:48 PM
Refering to Cells madh83 Excel Worksheet Functions 3 July 19th 06 11:39 PM
Refering to Cell's Name in Macro LSB Excel Programming 5 August 8th 03 03:51 AM


All times are GMT +1. The time now is 01:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"