#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22
Default Help with VBA

Two questions:
1.What's the VBA code that when executed gives me the column number of the
active cell?
2. How can I then reference this value in a following if then statement?

Thanks for any help.
Brian


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Help with VBA


c = ActiveCell.Column
If ActiveCell.Column = c Then


--
raypayette


------------------------------------------------------------------------
raypayette's Profile: http://www.excelforum.com/member.php...o&userid=29569
View this thread: http://www.excelforum.com/showthread...hreadid=566489

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22
Default Help with VBA

Thank you raypayette.
Do you mean that c and not "c" now assumes a numeric value? And that this
value changes as the cursor moves around?

Brian

"raypayette" wrote
in message ...

c = ActiveCell.Column
If ActiveCell.Column = c Then


--
raypayette


------------------------------------------------------------------------
raypayette's Profile:
http://www.excelforum.com/member.php...o&userid=29569
View this thread: http://www.excelforum.com/showthread...hreadid=566489



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Help with VBA


VBA assumes that a variable that wasn't defined is a Variant, not a
number, not a string.
Had "Option explicit" been specified, it should have been defined
either as a Variant or an Integer.
The advantage of a Variant is that it can be reused as need be in a
different context.
The variable c changes value with the current cell that is selected.


--
raypayette


------------------------------------------------------------------------
raypayette's Profile: http://www.excelforum.com/member.php...o&userid=29569
View this thread: http://www.excelforum.com/showthread...hreadid=566489

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22
Default Help with VBA

Thought I had lost this thread after spending time reformatting my HD. But
downloading 1000 headers did it. Thanks again raypayette.

Brian

"raypayette" wrote
in message ...

VBA assumes that a variable that wasn't defined is a Variant, not a
number, not a string.
Had "Option explicit" been specified, it should have been defined
either as a Variant or an Integer.
The advantage of a Variant is that it can be reused as need be in a
different context.
The variable c changes value with the current cell that is selected.


--
raypayette


------------------------------------------------------------------------
raypayette's Profile:
http://www.excelforum.com/member.php...o&userid=29569
View this thread: http://www.excelforum.com/showthread...hreadid=566489





Reply
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



All times are GMT +1. The time now is 11:43 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"