I need a code where:
1. It will find the next empty cell in row 1
2. add text to this empty cell
3. auto fill a formula down to the last non-empty cell
I have something similar below, but it is not dynamic.
1. It will find the next empty cell in row 1
2. add text to this empty cell
3. auto fill a formula down to the last non-empty cell
I have something similar below, but it is not dynamic.
VBA Code:
Range("L1").FormulaR1C1 = "CASE QTY"
Range("L1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
End With
With Selection
.Font.Bold = True
End With
Range("L2").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
ActiveCell.FormulaR1C1 = "1"
Selection.AutoFill Destination:=Range("L2:L" & Range("K" & Rows.Count).End(xlUp).Row)
Range(Selection, Selection.End(xlDown)).Select