Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Copy From 1 File to Another

I have 2 spreadheets PickX.xls and Picklist.xls
Picklist.xls is open and needs to receive data for column A only from
PickX.xls.
How do I write the code to get all of column A of PickX.xls into column A of
Picklist . I want all data whether it is numeric,blank or consisting of
characters.
I need this code to go just before the for loop that is set up in the
Picklist.xls.

Private Sub cmdRemoveEndOfData_Click()
Dim Rng As Range
Dim Rng2 As Range
Set Rng = Range("A1", Range("A65536").End(xlUp))
Set Rng2 = Range("K1")
For Each c In Rng
If Not IsNumeric(c) Then
c.Select
Selection.Cut
Rng2 = Range("K1").Select
ActiveSheet.Paste

End If
Next c
MsgBox "Mainframe character has been removed"
Range("K1").ClearContents
ThisWorkbook.Save
Call OpenTemplate
ThisWorkbook.Close


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Copy From 1 File to Another

Cyndy,

The following line should do it

Workbooks("PickX.xls").Worksheets("Sheet1").Column s("A:A").Copy _
Workbooks("PickList.xls").Worksheets("Sheet1").Cel ls(1, 1)

The code assumes that both PickX.xls and PickList.xls are open

Alok Joshi

"CyndyG" wrote:

I have 2 spreadheets PickX.xls and Picklist.xls
Picklist.xls is open and needs to receive data for column A only from
PickX.xls.
How do I write the code to get all of column A of PickX.xls into column A of
Picklist . I want all data whether it is numeric,blank or consisting of
characters.
I need this code to go just before the for loop that is set up in the
Picklist.xls.

Private Sub cmdRemoveEndOfData_Click()
Dim Rng As Range
Dim Rng2 As Range
Set Rng = Range("A1", Range("A65536").End(xlUp))
Set Rng2 = Range("K1")
For Each c In Rng
If Not IsNumeric(c) Then
c.Select
Selection.Cut
Rng2 = Range("K1").Select
ActiveSheet.Paste

End If
Next c
MsgBox "Mainframe character has been removed"
Range("K1").ClearContents
ThisWorkbook.Save
Call OpenTemplate
ThisWorkbook.Close


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Copy From 1 File to Another

Thanks Alok,but tis code is bypassing the for loop. I placed this code just
above the for loop. Picklist.xls is open,pickx.xls is not open yet.

"Alok" wrote:

Cyndy,

The following line should do it

Workbooks("PickX.xls").Worksheets("Sheet1").Column s("A:A").Copy _
Workbooks("PickList.xls").Worksheets("Sheet1").Cel ls(1, 1)

The code assumes that both PickX.xls and PickList.xls are open

Alok Joshi

"CyndyG" wrote:

I have 2 spreadheets PickX.xls and Picklist.xls
Picklist.xls is open and needs to receive data for column A only from
PickX.xls.
How do I write the code to get all of column A of PickX.xls into column A of
Picklist . I want all data whether it is numeric,blank or consisting of
characters.
I need this code to go just before the for loop that is set up in the
Picklist.xls.

Private Sub cmdRemoveEndOfData_Click()
Dim Rng As Range
Dim Rng2 As Range
Set Rng = Range("A1", Range("A65536").End(xlUp))
Set Rng2 = Range("K1")
For Each c In Rng
If Not IsNumeric(c) Then
c.Select
Selection.Cut
Rng2 = Range("K1").Select
ActiveSheet.Paste

End If
Next c
MsgBox "Mainframe character has been removed"
Range("K1").ClearContents
ThisWorkbook.Save
Call OpenTemplate
ThisWorkbook.Close


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Copy From 1 File to Another

Cyndy,
Create this sub in a module.

Sub CopyFromPickXToPickList()

Dim wbPX As Workbook

Set wbPX = Workbooks.Open("path and file name goes here")
wbPX.Windows(1).Visible = False
wbPX.Worksheets("Sheet1").Columns("A:A").Copy _
Workbooks("PickList.xls").Worksheets("Sheet1").Cel ls(1, 1)
wbPX.Close SaveChages:=False

End Sub

then call this function from your code.

The function above will open the file PickX.xls and will copy column A to
Picklist.xls and will close the PickX.xls file once it is done. I have not
debugged it but you can surely do that.

Alok

"CyndyG" wrote:

Thanks Alok,but tis code is bypassing the for loop. I placed this code just
above the for loop. Picklist.xls is open,pickx.xls is not open yet.

"Alok" wrote:

Cyndy,

The following line should do it

Workbooks("PickX.xls").Worksheets("Sheet1").Column s("A:A").Copy _
Workbooks("PickList.xls").Worksheets("Sheet1").Cel ls(1, 1)

The code assumes that both PickX.xls and PickList.xls are open

Alok Joshi

"CyndyG" wrote:

I have 2 spreadheets PickX.xls and Picklist.xls
Picklist.xls is open and needs to receive data for column A only from
PickX.xls.
How do I write the code to get all of column A of PickX.xls into column A of
Picklist . I want all data whether it is numeric,blank or consisting of
characters.
I need this code to go just before the for loop that is set up in the
Picklist.xls.

Private Sub cmdRemoveEndOfData_Click()
Dim Rng As Range
Dim Rng2 As Range
Set Rng = Range("A1", Range("A65536").End(xlUp))
Set Rng2 = Range("K1")
For Each c In Rng
If Not IsNumeric(c) Then
c.Select
Selection.Cut
Rng2 = Range("K1").Select
ActiveSheet.Paste

End If
Next c
MsgBox "Mainframe character has been removed"
Range("K1").ClearContents
ThisWorkbook.Save
Call OpenTemplate
ThisWorkbook.Close


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy data for match word from one file to another file mishak Excel Worksheet Functions 1 December 2nd 09 02:11 AM
How do I copy a excel file into a InDesign file correctly? cfb Excel Discussion (Misc queries) 2 June 14th 07 10:08 PM
copy the same raws of all sheets from about a 100 file to a new sheet of a book and save the file [email protected] Setting up and Configuration of Excel 0 March 14th 07 02:13 AM
How do I copy a file and attach a date to the name of the file hccatmo Excel Discussion (Misc queries) 1 February 23rd 07 08:21 PM
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM


All times are GMT +1. The time now is 08:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"