Dear all,
Recently I've started working with VBA & Macros and although I've come a long way (humbly said), I've stumbled upon a problem. Right now, I am able to copy&paste the right cells in the right place (clicking a button means adding (pasting) a range of copied cells below the last filled cell range) and now I am also able to delete the cells. The last thing I need is a font change, only for the pasted cells.
With my current knowledge, I've been able to correctly adjust the font only of the first set of pasted cells. So, in other words, my font change code is static where I need it to be changing with range, dynamic. This means that every part of cells pasted below gets the same font.
This is my code:
Sub UpdateProjectOverview()
Sheets("Business Case - Project View").Select
Range("C8:C13").Select
Selection.Copy
Range("C" & Rows.Count).End(xlUp).Offset(5, 0).Select
ActiveSheet.Paste
Selection = Selection.Value
Application.CutCopyMode = False
Range("D8:P13").Select
Selection.Copy
Range("D" & Rows.Count).End(xlUp).Offset(2, 0).Select
ActiveSheet.Paste
Selection = Selection.Value
Application.CutCopyMode = False
Columns("C:C").EntireColumn.AutoFit
Sheets("Business Case - Project View").Select
If Not IsEmpty("C15:C20") Then
Range("C15:C20,D15:G15,I15:J15,L15,N15:O15,N20:O20").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.599993896298105
.PatternTintAndShade = 0
End With
Range("D16:G20,I16:J20,L16:L20,N16:O19").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent1
.TintAndShade = 0.799981688894314
.PatternTintAndShade = 0
End With
End If
Application.CutCopyMode = False
I guess that right at the lines I've made bold, I need to insert this 'dynamic code', the sort of code used in the underlined/italic lines.
Lots of thanks in advance, any help is welcome!
Cheers
Bookmarks