Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi all, How can I setup a macro that will pull data in from a range.. From one xls spreadsheet(testLog.xls)(summary tab) to another (Script.xls)(findings tab)? -- lbargers ------------------------------------------------------------------------ lbargers's Profile: http://www.excelforum.com/member.php...o&userid=32798 View this thread: http://www.excelforum.com/showthread...hreadid=527216 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi there lbargers,
You could try something like this ... Sub CopyMyDataFromBookToBook() Dim wbCopy as Workbook, wbPaste as Workbook Dim wsCopy as Worksheet, wsPaste as Worksheet Dim rngCopy as Range, rngPaste as Range Set wbCopy = Workbooks("testLog.xls") Set wbPaste = Workbooks("Script.xls") Set wsCopy = wbCopy.Sheets("summary") Set wsPaste = wbPaste.Sheets("findings") Set rngCopy = wsCopy.Range("A1:A10") Set rngPaste = wsPaste.Range("A1:A10") rngCopy.Copy Destination:=rngPaste Application.CutCopyMode = False End Sub Change the ranges to suit. HTH -- Regards, Zack Barresse, aka firefytr To email, remove NOSPAM "lbargers" wrote in message ... Hi all, How can I setup a macro that will pull data in from a range.. From one xls spreadsheet(testLog.xls)(summary tab) to another (Script.xls)(findings tab)? -- lbargers ------------------------------------------------------------------------ lbargers's Profile: http://www.excelforum.com/member.php...o&userid=32798 View this thread: http://www.excelforum.com/showthread...hreadid=527216 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hey Zach, Thanks for your fast response... Will the method you showed copy all the data in the fields, or just those that contain data? The file are located in different directories, how do I set the path? Thanks again, your help is greatly appreciated... -- lbargers ------------------------------------------------------------------------ lbargers's Profile: http://www.excelforum.com/member.php...o&userid=32798 View this thread: http://www.excelforum.com/showthread...hreadid=527216 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It will only copy the range you specify. Are you looking at a
variable/dynamic range? All of the data? Also, I assumed the workbooks would be open. If they are not (or you don't know if they will be at runtime) you can use something like this ... Sub CopyMyDataFromBookToBook() Dim wbCopy As Workbook, wbPaste As Workbook Dim wsCopy As Worksheet, wsPaste As Worksheet Dim rngCopy As Range, rngPaste As Range If IsWbOpen("testLog.xls") Then Set wbCopy = Workbooks("testLog.xls") Else Set wbCopy = Workbooks.Open("C:\YourPathHere\testLog.xls") End If If IsWbOpen("Script.xls") Then Set wbPaste = Workbooks("Script.xls") Else Set wbPaste = Workbooks.Open("C:\YourPathHere\Script.xls") End If Set wsCopy = wbCopy.Sheets("summary") Set wsPaste = wbPaste.Sheets("findings") Set rngCopy = wsCopy.Range("A1:A10") Set rngPaste = wsPaste.Range("A1:A10") rngCopy.Copy Destination:=rngPaste Application.CutCopyMode = False End Sub Function IsWbOpen(strName As String) As Boolean On Error Resume Next IsWbOpen = Len(Workbooks(strName).Name) End Function -- Regards, Zack Barresse, aka firefytr To email, remove NOSPAM "lbargers" wrote in message ... Hey Zach, Thanks for your fast response... Will the method you showed copy all the data in the fields, or just those that contain data? The file are located in different directories, how do I set the path? Thanks again, your help is greatly appreciated... -- lbargers ------------------------------------------------------------------------ lbargers's Profile: http://www.excelforum.com/member.php...o&userid=32798 View this thread: http://www.excelforum.com/showthread...hreadid=527216 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I'll explain a little bit further as I am brand new to excel and was assigned an excel automation project at work. I am an applications developer and understand VB code. My question is how can I set up a marco or other code routine to pull data into my spreadsheet from a seperate spreadsheet at a different directory location. The first spreadsheet (testScript.xls) contains a [Summary Tab]. The second spreadsheet(SummaryScript.xls) will contain a [Findings Tab]. I want the second spreadsheet (SummaryScript.xls) to pull data from the [Summary Tab] of the testScript.xls. The data I want pulled will come from row 3, starting at Column E through Column IV(E3:IV3) As the loop occurs I would like data in this range to populate rows in The [Findings Tab] of the SummaryScript.xls Spreadsheet. What I want to do is copy the cell data in row 3 of any column (there could be up to 255) where data is present, I would like that data sent or pullled into column C of the [Findings Tab] in he SummaryScript.xls. But it should be place row after row. For instance if columns E3, L3, M3, AD3, AJ3... Contain a value I want these values respectively placed into column C in the Findings Tab... Thanks, Larry Bargers -- lbargers ------------------------------------------------------------------------ lbargers's Profile: http://www.excelforum.com/member.php...o&userid=32798 View this thread: http://www.excelforum.com/showthread...hreadid=527216 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
So if E3 has data, then no data from F3:J3, do not copy those, etc? And you
want this data pasted into column C, starting at row 3? Do you want the blanks (i.e. F3:J3) pasted as well, or only those with data? Will this be done multiple times? Do we need to find the last row in column C? I'm assuming you'll be calling this from the SummaryScript workbook? -- Regards, Zack Barresse, aka firefytr To email, remove NOSPAM "lbargers" wrote in message ... I'll explain a little bit further as I am brand new to excel and was assigned an excel automation project at work. I am an applications developer and understand VB code. My question is how can I set up a marco or other code routine to pull data into my spreadsheet from a seperate spreadsheet at a different directory location. The first spreadsheet (testScript.xls) contains a [Summary Tab]. The second spreadsheet(SummaryScript.xls) will contain a [Findings Tab]. I want the second spreadsheet (SummaryScript.xls) to pull data from the [Summary Tab] of the testScript.xls. The data I want pulled will come from row 3, starting at Column E through Column IV(E3:IV3) As the loop occurs I would like data in this range to populate rows in The [Findings Tab] of the SummaryScript.xls Spreadsheet. What I want to do is copy the cell data in row 3 of any column (there could be up to 255) where data is present, I would like that data sent or pullled into column C of the [Findings Tab] in he SummaryScript.xls. But it should be place row after row. For instance if columns E3, L3, M3, AD3, AJ3... Contain a value I want these values respectively placed into column C in the Findings Tab... Thanks, Larry Bargers -- lbargers ------------------------------------------------------------------------ lbargers's Profile: http://www.excelforum.com/member.php...o&userid=32798 View this thread: http://www.excelforum.com/showthread...hreadid=527216 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy and Paste with Macro Between sheets | Excel Discussion (Misc queries) | |||
Copy&paste of several sheets | Excel Discussion (Misc queries) | |||
Copy and paste between sheets | Excel Programming | |||
Copy and paste spread sheet | Excel Programming | |||
MS Excel Sheets...how to copy and paste ? | Excel Programming |