Convert to Number
Please try this:
With obj_Sheet1
LstRow = .Range("A1").End(xlDown).Row
.Cells(LstRow + 1, 1).Value = "1"
.Cells(LstRow + 1, 1).Copy
With Range("A1:A" & LstRow)
.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
.NumberFormat = "0.00"
End With
.Cells(LstRow + 1, 1).ClearContents
End With
"David" wrote:
Hello all,
I am using this bit of Excel Automation code in Access 2003 VBA to copy data
from one tab to another. Problem is, column A is being presented in Excel as
text. I would like column A to be converted to number via code.
Any assistance you can provide is appreciated.
20 strFile = "C:\Program Files\Database\TRANSFERS.xls"
'This will export the query to the spreadsheet. Since there is
already a Sheet1 tab,
'it will create a tab titled Sheet11
30 DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"qry_List", strFile, True, "Sheet1"
150 Set objXLBook = GetObject(strFile)
' We can use the Parent
' property of the workbook object
' to get a pointer to Excel's
' Application object
160 Set objXLApp = objXLBook.Parent
170 objXLBook.Windows(1).Visible = True
180 Set obj_Sheet1 = objXLBook. _
Worksheets("Sheet1")
190 Set obj_Sheet11 = objXLBook. _
Worksheets("Sheet11")
200 LastRow = obj_Sheet11.UsedRange.Rows.Count
210 If LastRow 1 Then
220 obj_Sheet11.Range("A1:J" & LastRow).Copy
230 obj_Sheet1.Range("A1:J1").pastespecial -4163
240 obj_Sheet1.Range("A1").select
|