How can I troubleshoot the cause behind this failed bit of code? I've searched all over the web including Microsoft and cannot see anything wrong with how I wrote this script. But, contrary to all I read, the formatting of the cleared cell also disappears. I am stumped and would appreciate any ideas. Maybe it is a known bug? maybe there is a workaround? I tried to set a cell formatting but that didn't work either.
the code DOES empty the cell contents just fine, but i really really want to retain the formatting, as the default is very tiny font size and disruptive to the viewer experience.
here's the code I'm using. i cross posted over at excelguru but so far only views, no ideas.
Option Explicit
Private Sub CommandButton1_Click()
Dim SKU As String, Qty As String, TFC As String, LTFC As String
Worksheets("dashboard - beta").Select
SKU = Range("D6")
Qty = Range("L2")
TFC = Range("L3")
LTFC = Range("M3")
Worksheets("Costing Log").Select
Worksheets("Costing Log").Range("B4").Select
If Worksheets("Costing Log").Range("B4").Offset(1, 0) <> "" Then
Worksheets("Costing Log").Range("B4").End(xlDown).Select
End If
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = SKU
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Qty
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TFC
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = LTFC
Worksheets("dashboard - beta").Select
Worksheets("dashboard - beta").Range("a5:a34").ClearContents
Worksheets("dashboard - beta").Range("L2").ClearContents
Worksheets("dashboard - beta").Range("j10:j34").ClearContents
End Sub
Sub FontSize()
'code for changing font size
Worksheets("dashboard - beta").Range("L2").Font.Size = 22
End Sub