PDA

View Full Version : [SOLVED:] Format column in workbook



Klartigue
10-24-2013, 01:12 PM
I have a macro-enabled workbook. Is there a code that can be built into this workbook that says for column G, format the cells in number format, use 1000 separator (,) and 0 decimal places. I have manually do it but each time I copy and paste data into this workbook, the format is erased. So I would like to "hard code" column G to always have this format if that is possible?

mancubus
10-24-2013, 01:38 PM
Sub NumFormat()


Range("G2:G" & Cells(Rows.Count, "G").End(xlUp).Row).NumberFormat = "#,###"


End Sub

Klartigue
10-24-2013, 01:48 PM
That works great, thank you!

mancubus
10-24-2013, 02:13 PM
You are welcome. I assume G1 is a header cell.