Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm exporting data from Access to Excel
On one worksheet I will have the data from my database I need to copy that data to a column on another worksheet in the workbook I will be tracking the data daily, so I need it to copy the data to a new column every day (with a date stamp) so I can compare the changes. Any help is appreciated! -- Mark W. Hanford |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That's fairly easy. What's the "from" range and what's the "to" range?
"MWH" wrote in message ... I'm exporting data from Access to Excel On one worksheet I will have the data from my database I need to copy that data to a column on another worksheet in the workbook I will be tracking the data daily, so I need it to copy the data to a new column every day (with a date stamp) so I can compare the changes. Any help is appreciated! -- Mark W. Hanford |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This could help you:
----------------------------- Sub copyit() Application.ScreenUpdating = False Dim rfoundempty As Range Dim inow As String Dim tgt, src As Worksheet Dim x As Integer Set src = Workbooks("sourcebookname").Worksheets("sourceshee tname") Set tgt = Workbooks("targetbookname").Worksheets("targetshee tname") src.Columns(1).Select Selection.Copy tgt.Activate x = Application.WorksheetFunction.CountA(src.Range("1: 1")) + 1 Do Until Application.WorksheetFunction.CountA(tgt.Columns(x )) = 0 x = x + 1 Loop tgt.Activate tgt.Columns(x).Select activesheet.Paste Cells(1, x).AddComment Cells(1, x).Comment.Visible = False Cells(1, x).Comment.Text Text:="imported:" & Chr(10) & Now() Application.ScreenUpdating = False End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Be careful, this will overwrite your data every time you run it, and uses this clipboard (and is therefore interruptable by other
Windows operations). "Roman" wrote in message oups.com... This could help you: ----------------------------- Sub copyit() Application.ScreenUpdating = False Dim rfoundempty As Range Dim inow As String Dim tgt, src As Worksheet Dim x As Integer Set src = Workbooks("sourcebookname").Worksheets("sourceshee tname") Set tgt = Workbooks("targetbookname").Worksheets("targetshee tname") src.Columns(1).Select Selection.Copy tgt.Activate x = Application.WorksheetFunction.CountA(src.Range("1: 1")) + 1 Do Until Application.WorksheetFunction.CountA(tgt.Columns(x )) = 0 x = x + 1 Loop tgt.Activate tgt.Columns(x).Select activesheet.Paste Cells(1, x).AddComment Cells(1, x).Comment.Visible = False Cells(1, x).Comment.Text Text:="imported:" & Chr(10) & Now() Application.ScreenUpdating = False End Sub |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Range("A2:A56") to the same rows different columns on another worksheet,
Also I would like a date stamp =TODAY() to be in A1 "JPW" wrote in message ... That's fairly easy. What's the "from" range and what's the "to" range? "MWH" wrote in message ... I'm exporting data from Access to Excel On one worksheet I will have the data from my database I need to copy that data to a column on another worksheet in the workbook I will be tracking the data daily, so I need it to copy the data to a new column every day (with a date stamp) so I can compare the changes. Any help is appreciated! -- Mark W. Hanford |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This won't overwrite the data. It's finding an empty column on the
target sheet and paste the data into it. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Code halts at "src.Columns(1).Select"
Any suggestions? "Roman" wrote in message oups.com... This won't overwrite the data. It's finding an empty column on the target sheet and paste the data into it. |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It works OK for me.
I guess there could be a problem in sourcebookname, sourcesheetname... definitions. They should look like: Set src = Workbooks("book1").Wo*rksheets("sheet1") ' that is your source book and sheet Set tgt = Workbooks("book2").Wo*rksheets("sheet2") 'that is your target book and sheet Well I´m not VB proffesional in anyway, so please take the code as a discussion or study material rather than a bussiness solution. Keep learning. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA code needed | New Users to Excel | |||
Copy Code Needed | Excel Worksheet Functions | |||
Code Needed | Excel Programming | |||
Better code needed | Excel Programming | |||
Fw:code needed | Excel Programming |