Dynamically Generated Range using Macro

  • Thread starter Thread starter JM.EE01
  • Start date Start date
J

JM.EE01

Hope someone can help me.

I need to dynamically generate a range. The only value I know are the
Columns (C to H); the row index is what needs to be dynamic.

Example:
## - is the row index which will change from file to file.

With Worksheets(ShtName).Range("C##:H##")
.Merge across = True
.Font.Bold = True
.Font.Size = 10
.Font.Italic = False
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.BorderAround ColorIndex:=1, Weight:=3
.Interior.ColorIndex = 2
.Value = "INSTRUCTIONS"
End With

If someone can help and needs more information, just drop me an email
or reply.

Thanks JM.EE01
 
Dim lRow as Long
Dim lColumn as Long

lRow = 10
lColumn=20

With Worksheets(ShtName).range("C" & lRow & ":H" & lColumn)
.blah
End With

HTH
 
Definitely did that trick! Many thanks especially for the speedy
response.

JM
 

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