#1   Report Post  
gradientS
 
Posts: n/a
Default A Quickie


I have ...

Dim c As String
Dim r As Integer

How do I set ...

c = Current Active Column
r = Current Active Row

... so that no matter where the active cell is on the worksheet, these
values will be returned. Is there such a thing a
WorksheetFunction.CountA for Rows and Columns?


--
gradientS
------------------------------------------------------------------------
gradientS's Profile: http://www.excelforum.com/member.php...o&userid=16563
View this thread: http://www.excelforum.com/showthread...hreadid=345777

  #2   Report Post  
Robin Hammond
 
Posts: n/a
Default

Probably better off using numeric values for both, then using Cells(x,y) to
refer to a particular cell.

e.g.
Dim nCol as integer
Dim lRow as long
nCol = activecell.column
lRow = activecell.row

msgbox "There are " & activesheet.UsedRange.Rows.Count & " used rows"

Robin Hammond
www.enhanceddatasystems.com

"gradientS" wrote in message
...

I have ...

Dim c As String
Dim r As Integer

How do I set ...

c = Current Active Column
r = Current Active Row

.. so that no matter where the active cell is on the worksheet, these
values will be returned. Is there such a thing a
WorksheetFunction.CountA for Rows and Columns?


--
gradientS
------------------------------------------------------------------------
gradientS's Profile:
http://www.excelforum.com/member.php...o&userid=16563
View this thread: http://www.excelforum.com/showthread...hreadid=345777



  #3   Report Post  
gradientS
 
Posts: n/a
Default


thank you... just curious... why column as integer and row as long if A
is column and 1 is row as in A1?


--
gradientS
------------------------------------------------------------------------
gradientS's Profile: http://www.excelforum.com/member.php...o&userid=16563
View this thread: http://www.excelforum.com/showthread...hreadid=345777

  #4   Report Post  
gradientS
 
Posts: n/a
Default


thank you for your help


--
gradientS
------------------------------------------------------------------------
gradientS's Profile: http://www.excelforum.com/member.php...o&userid=16563
View this thread: http://www.excelforum.com/showthread...hreadid=345777

  #5   Report Post  
Robin Hammond
 
Posts: n/a
Default

256 columns fits in an integer data type
65000 rows doesn't

Robin Hammond
www.enhanceddatasystems.com

"gradientS" wrote in message
...

thank you... just curious... why column as integer and row as long if A
is column and 1 is row as in A1?


--
gradientS
------------------------------------------------------------------------
gradientS's Profile:
http://www.excelforum.com/member.php...o&userid=16563
View this thread: http://www.excelforum.com/showthread...hreadid=345777





  #6   Report Post  
Harald Staff
 
Posts: n/a
Default

Don't use Integer, use Long. See
http://msdn.microsoft.com/library/de...rdatatypes.asp

quote:
"Traditionally, VBA programmers have used integers to hold small numbers,
because they required less memory. In recent versions, however, VBA converts
all integer values to type Long, even if they are declared as type Integer.
Therefore, there is no longer a performance advantage to using Integer
variables; in fact, Long variables might be slightly faster because VBA does
not have to convert them."

HTH. Best wishes Harald


"gradientS" skrev i melding
...

thank you... just curious... why column as integer and row as long if A
is column and 1 is row as in A1?


--
gradientS
------------------------------------------------------------------------
gradientS's Profile:

http://www.excelforum.com/member.php...o&userid=16563
View this thread: http://www.excelforum.com/showthread...hreadid=345777



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 04:41 AM.

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"