B
Bullfrog
Is there a way to store formating information of a cell/range along
with the value of it inside an object variable or similar structure?
Here code in question.
Private Sub GetRanges_Click()
Dim xlwb As Excel.Workbook
Dim xlws As Excel.Worksheet
Dim fullpath As String
Dim temp As Variant ' should this be a range object?
fullpath = "C:\Documents and Settings\smg706\Desktop\Traffic Desktop\"
Set xlwb = Workbooks.Open(fullpath & "ge_matrix.xls")
Excel.Application.Visible = True
Set xlws = xlwb.Sheets(1)
xlws.Activate
temp = Range("B9:AM9") ' range value or object?
Set xlws = xlwb.Sheets(2)
xlws.Activate
Range("b9:am9") = temp
' The above line copies all cell values to the new sheet, but does not
' preserve the cell formatting.
End Sub
LIke the comment says
' The above line copies all cell values to the new sheet, but does not
' preserve the cell formatting.
This code is running inside a MS access form, and accessing Excel.
If there is no automated way, I will just have to loop for each cell in
the range, and apply formating according to cell value after the
transfer of data.
Any help will be appreciated.
Thanks,
Sylvain
with the value of it inside an object variable or similar structure?
Here code in question.
Private Sub GetRanges_Click()
Dim xlwb As Excel.Workbook
Dim xlws As Excel.Worksheet
Dim fullpath As String
Dim temp As Variant ' should this be a range object?
fullpath = "C:\Documents and Settings\smg706\Desktop\Traffic Desktop\"
Set xlwb = Workbooks.Open(fullpath & "ge_matrix.xls")
Excel.Application.Visible = True
Set xlws = xlwb.Sheets(1)
xlws.Activate
temp = Range("B9:AM9") ' range value or object?
Set xlws = xlwb.Sheets(2)
xlws.Activate
Range("b9:am9") = temp
' The above line copies all cell values to the new sheet, but does not
' preserve the cell formatting.
End Sub
LIke the comment says
' The above line copies all cell values to the new sheet, but does not
' preserve the cell formatting.
This code is running inside a MS access form, and accessing Excel.
If there is no automated way, I will just have to loop for each cell in
the range, and apply formating according to cell value after the
transfer of data.
Any help will be appreciated.
Thanks,
Sylvain