Hi all,
I've got some code running that does what I want just fine. But I was wondering if it was possible to change the .value part of the code to something that includes not only the cell value, but also the way the cell is formatted (fill, font, align etc. you get the idea).
Only asking because if it is possible, it saves running an additional bit of code with the sole purpose of making things pretty - you know how it often is with these things, sometimes presentation is as, if not more, important than the actual data.
I understand if its the kind of thing that depends on what the code is doing too, so here's mine
Thanks all!
I've got some code running that does what I want just fine. But I was wondering if it was possible to change the .value part of the code to something that includes not only the cell value, but also the way the cell is formatted (fill, font, align etc. you get the idea).
Only asking because if it is possible, it saves running an additional bit of code with the sole purpose of making things pretty - you know how it often is with these things, sometimes presentation is as, if not more, important than the actual data.
I understand if its the kind of thing that depends on what the code is doing too, so here's mine
VBA Code:
Sub FillData3()
Dim Cl As Range
Dim dic As Object
Set dic = CreateObject("scripting.dictionary")
With Sheets("Sheet1") 'the sheet with values and formatting
For Each Cl In .Range("A1", .Range("A" & Rows.Count).End(xlUp))
dic(Cl.Value) = Cl.Offset(, 1).Value
Next Cl
End With
With Sheets("Sheet2") 'where I would like formatting to appear
For Each Cl In .Range("C4:C148", Range("C4").End(xlToRight))
If dic.Exists(Cl.Value) Then Cl.Value = dic(Cl.Value)
Next Cl
End With
End Sub
Thanks all!