ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Dynamically Generated Range using Macro (https://www.excelbanter.com/excel-worksheet-functions/99452-dynamically-generated-range-using-macro.html)

[email protected]

Dynamically Generated Range using Macro
 
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


Ardus Petus

Dynamically Generated Range using Macro
 
Dim lRow as Long
Dim lColumn as Long

lRow = 10
lColumn=20

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

HTH
--
AP

a écrit dans le message de news:
...
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




[email protected]

Dynamically Generated Range using Macro
 
Definitely did that trick! Many thanks especially for the speedy
response.

JM

Ardus Petus wrote:
Dim lRow as Long
Dim lColumn as Long

lRow = 10
lColumn=20

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

HTH
--
AP

a écrit dans le message de news:
...
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




All times are GMT +1. The time now is 04:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com