A Quickie

  • Thread starter Thread starter gradientS
  • Start date Start date
G

gradientS

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?
 
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
 
thank you... just curious... why column as integer and row as long if A
is column and 1 is row as in A1?
 
Don't use Integer, use Long. See
http://msdn.microsoft.com/library/d...-us/modcore/html/decontheintegerdatatypes.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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top