View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Sheeloo Sheeloo is offline
external usenet poster
 
Posts: 793
Default Using variable for cell reference

instead of using "G9" use "G" & mRow

eg
Range("G9") can be replaced by Range("G" & mRow)

Sub t()
MsgBox "Direct reference: G9=" & Range("G9")
mRow = 9
MsgBox "Indirect reference: G9= " & Range("G" & mRow)
End Sub

"bmurlidhar" wrote:

how can I use variable for cell reference. IF i want to refere G9
cell and my variable mRow have value 9 how can use in excel macro
coding