PEV
02-20-2012, 09:23 AM
I am trying to format with color the output from a Userform onto the spreadsheet. The below code (or part of) is attached to a Button on the Userform. How can merge the two parts? Part 1 being the value in ComboBox 86 being sent to the sheet and Part 2 being the formatting. For now, it is formating any active cells chosen only and not the destination cell (offset (1,0)) for example. I was using Conditional Formatting in Excel 2010 but many of the users are still on 2003 which limits to 3 conditional formats
Dim LastRow As Object
Set LastRow = Sheets("tt").Range("B65536, M65536").End(xlUp)
'Header & origin destination
Application.ScreenUpdating = False
LastRow.Offset(1, 0).Value = ComboBox86.Text
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Selection.Font.Bold = True
LastRow.Offset(1, 1).Value = ("")
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Dim LastRow As Object
Set LastRow = Sheets("tt").Range("B65536, M65536").End(xlUp)
'Header & origin destination
Application.ScreenUpdating = False
LastRow.Offset(1, 0).Value = ComboBox86.Text
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Selection.Font.Bold = True
LastRow.Offset(1, 1).Value = ("")
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
.PatternTintAndShade = 0
End With