View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Arvi Laanemets Arvi Laanemets is offline
external usenet poster
 
Posts: 510
Default Setting a variable using COUNTA

Hi

Define the number of rows as named value, i.e
RowNum=COUNTA(Sheet1!$A:$A)

In VBA, you can always refer to named value:
....
varNumberOfRows=[RowNum]
....

--
When sending mail, use address arvil<attarkon.ee
Arvi Laanemets


"Gerrym" wrote in message
...
Can I set a variable using COUNTA to count non blank rows
and then use the variable in a macro with
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-5],LCCUS!
R2C1:VARIABLE,2)"

I need this as the number of rows in the sheet LCCUS can
vary.

TKS