Dim wb As Workbook
Application.ScreenUpdating = False
Set wb = Workbooks.Open("C:\FOReport.xls", True, True)
With ThisWorkbook.Worksheets("Report")
.Range("A5:F798") = ""
.Range("A5:F798").Value = wb.Worksheets("Report").Range("C7:H80").Value
.Range("A5:F798").Numberformat = "000000"
End With
this will show 6 or more digits. If the value in the cell is less than 6
digits, it will display leading zeros. Adjust to fit your requirements.
--
Regards,
Tom Ogilvy
"DavidW" wrote:
I'm importing a report from another workbook. How can I format column A
of the destination with leading zeros in the code below? The source is
formatted as General. Thanks.
Code:
--------------------
Dim wb As Workbook
Application.ScreenUpdating = False
Set wb = Workbooks.Open("C:\FOReport.xls", True, True)
With ThisWorkbook.Worksheets("Report")
.Range("A5:F798") = ""
.Range("A5:F798").Value = wb.Worksheets("Report").Range("C7:H80").Value
End With
--------------------
--
DavidW
------------------------------------------------------------------------
DavidW's Profile: http://www.excelforum.com/member.php...o&userid=32630
View this thread: http://www.excelforum.com/showthread...hreadid=534117