Hi Alan,
I was trying to learn how to use the current region as i see it in various macros.
I avoid these macros as I always get stuck on the current region, and then you have the offset and it gets a bit messy.
In this Example I was testing to see if I could list some cells in Column D to format in current worksheet.
Column D - Cells to Format | Column E - Font Name
H122 | Candara
X124 | Arial
The below is just for illustration - I dont need a working version.
It would be useful to know if I targeted the current region cells in the correct manner - which I have not.
Sub Format_Cells()
Dim oCellRng As Range
Dim oCellTarget As Range
Set oCellRng = ActiveSheet.Cells(2, 4).CurrentRegion ' Cells to Format Column D
Set OFontName = ActiveSheet.Cells(2, 5).CurrentRegion 'Font Name to Apply to Cells Listed in Column D (Column E)
For Each oCellTarget In oCellRng.Rows
With oCellTarget
ActiveSheet.Range(.Cells(1).Value).Select ActiveSheet.Range(.Cells(2).Value).Font.Name ' This is tricky bit
End With
Next
End Sub
There are easier ways to do what I am trying to do - but it would be nice not to run every time I see the current region
thank you
sl
Bookmarks