Good Afternoon,
Thanks in advance for any assistance that can be offered, now on to the dilemma.
Background: I am trying to create a dynamic repeatable formatting process. I have an ever changing list of metrics that are either populated with a value or not. Each metric with a value has a graph created based on the last 12 weeks. I have a structured view witch places all of the graphs onto a single worksheet. The formatting and placement of the graphs are what I am tying to solve for now.
Problem: The current code I have now creates a single instance of the formatting for a single metric. I want to be able to repeat this formatting based on a cell number (in my below code this would be cell A1). However, the code needs to be dynamic since the number will be ever changing.
FYI:
Details: So the goal is to build the formatting starting in cell B2:F11 then repeat this to the right 5 times. I can get it to repeat but it just does it in place (B2) instead of offsetting to the next area (which should be G2:K11, then L2:P11, Q2:U11, V2:Z11).
Any assistance would be really appreciated here, since I am racking my brain and just cannot figure out how to make this work. Thanks.
Thanks in advance for any assistance that can be offered, now on to the dilemma.
Background: I am trying to create a dynamic repeatable formatting process. I have an ever changing list of metrics that are either populated with a value or not. Each metric with a value has a graph created based on the last 12 weeks. I have a structured view witch places all of the graphs onto a single worksheet. The formatting and placement of the graphs are what I am tying to solve for now.
Problem: The current code I have now creates a single instance of the formatting for a single metric. I want to be able to repeat this formatting based on a cell number (in my below code this would be cell A1). However, the code needs to be dynamic since the number will be ever changing.
Code:
Sub Offset()
iNumberOfLoops = Range("A1").Value
For i = 1 To iNumberOfLoops
With Range("B2").Offset(6, 0)
Call Format
End With
Next i
End Sub
FYI:
Code:
Sub Format()'
' Formatting Macro
'
'Build the header for the metric name
Range("B2:F2").Select
With Selection
.HorizontalAlignment = xlCenter
.MergeCells = True
End With
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
'Format the outline of cells for the graph
Range("B2:F11").Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
End Sub
Details: So the goal is to build the formatting starting in cell B2:F11 then repeat this to the right 5 times. I can get it to repeat but it just does it in place (B2) instead of offsetting to the next area (which should be G2:K11, then L2:P11, Q2:U11, V2:Z11).
Any assistance would be really appreciated here, since I am racking my brain and just cannot figure out how to make this work. Thanks.