What is the proper syntex for .cells or .range ?

  • Thread starter Thread starter cgnotrom
  • Start date Start date
C

cgnotrom

Hi All
I am trying to read the array (m1:O1) in a Range command

using a for next loop where 'gm' is the incrementor
For gm =1 to 10

need to convert .Range("M1:O1") to increment .Range(gm,13:gm,15)
or .Cells(gm,13:gm,15)
neither seems to get past the debugger.
Thanks for any guidance !
Chris
 
Hi All
I am trying to read the array (m1:O1) in a Range command

using a for next loop where   'gm' is the incrementor
For gm =1 to 10

need to convert  .Range("M1:O1") to increment .Range(gm,13:gm,15)
or  .Cells(gm,13:gm,15)
neither seems to get past the debugger.
Thanks for any guidance !
Chris

Hi Chris

Here's a way to do it:

Dim TargetRange As Range
Set TargetRange = Range("M1:O10")

For Each c In TargetRange
MsgBox c.Value
Next

Regards,
Per
 

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

Back
Top