W
Withnails
Hi
I would like to ensure that all cells in column A have 7 digits, and where
they do not the first few are given as zeros. The following macro does this
by creating a new column, is it possible to simply grab the data below A1
(from A2 down) and achieve the same result...?
The code which works (but creates a new column that i would rather do
without) is as follows;
Selection.EntireColumn.Insert
ActiveCell.Select
ActiveCell.FormulaR1C1 = "=TEXT(RC[1],""00#####"")"
ActiveCell.Select
Selection.Copy
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, -1).Range("A1").Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub
PS: As you can tell i'm pretty new to all this....
I would like to ensure that all cells in column A have 7 digits, and where
they do not the first few are given as zeros. The following macro does this
by creating a new column, is it possible to simply grab the data below A1
(from A2 down) and achieve the same result...?
The code which works (but creates a new column that i would rather do
without) is as follows;
Selection.EntireColumn.Insert
ActiveCell.Select
ActiveCell.FormulaR1C1 = "=TEXT(RC[1],""00#####"")"
ActiveCell.Select
Selection.Copy
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, -1).Range("A1").Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub
PS: As you can tell i'm pretty new to all this....