Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Copying Data

I'm fairly new to this and am having difficulty trying to solve what to me
seems like an easy problem!!!! (spent hours on line searching)

I want to import data in specific cells from one sheet to another sheet in a
different workbook using VBA

I don't want to link the two files and I'm hoping to avoid using loads and
loads of code. (as this makes it difficult when changes have to be made.

I could use the macro recorder and copy contents of cell A1 and paste it
into cell C3 in the second book and so on. But there are more than 80 cells
i want to copy from the first worksheet to the second - there is a set
pattern e.g. cell a1 to cell c3, cell a2 to cell d5 (obviously too many to
list here)

I would like some form of solution that lists the from and to cell
references on a spare worksheet and uses these lists to pass values that VBA
can loop through (struggling to gert to grips with single loops let alone
using 2 together)

Any suggestions appreciated


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copying Data


Gazza, Is there any pattern among the cells, such as workbook1 cell1
workbook2 plus 2 cells to right? If there a common formula or patter
through the 80 cells, then yes a simply VBA loop can be created.

JoJ

--
JoJ
-----------------------------------------------------------------------
JoJo's Profile: http://www.excelforum.com/member.php...fo&userid=1130
View this thread: http://www.excelforum.com/showthread.php?threadid=46610

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Copying Data

We have sent you direct precise code and we give it again

workbooks(1).sheets("a_a").range("a1").copy
workbooks(2).sheets("ca_a").range("c3")

Your destination ranges appear random. You cannot loop this.

"Gazza" <mallin"nospam" wrote:

I'm fairly new to this and am having difficulty trying to solve what to me
seems like an easy problem!!!! (spent hours on line searching)

I want to import data in specific cells from one sheet to another sheet in a
different workbook using VBA

I don't want to link the two files and I'm hoping to avoid using loads and
loads of code. (as this makes it difficult when changes have to be made.

I could use the macro recorder and copy contents of cell A1 and paste it
into cell C3 in the second book and so on. But there are more than 80 cells
i want to copy from the first worksheet to the second - there is a set
pattern e.g. cell a1 to cell c3, cell a2 to cell d5 (obviously too many to
list here)

I would like some form of solution that lists the from and to cell
references on a spare worksheet and uses these lists to pass values that VBA
can loop through (struggling to gert to grips with single loops let alone
using 2 together)

Any suggestions appreciated



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Copying Data

Further, if you do not vary the cells every time (which you said you would),
and you list the 80 or 250 pairs of cells in a spare worksheet, loop by all
means.

for i = 1 to 80
fromcell=range(...)
tocell=range(...)
workbooks(1).sheets("a_a").range(fromcell).copy
workbooks(2).sheets("ca_a").range(tocell)
next i

"PY & Associates" wrote:

We have sent you direct precise code and we give it again

workbooks(1).sheets("a_a").range("a1").copy
workbooks(2).sheets("ca_a").range("c3")

Your destination ranges appear random. You cannot loop this.

"Gazza" <mallin"nospam" wrote:

I'm fairly new to this and am having difficulty trying to solve what to me
seems like an easy problem!!!! (spent hours on line searching)

I want to import data in specific cells from one sheet to another sheet in a
different workbook using VBA

I don't want to link the two files and I'm hoping to avoid using loads and
loads of code. (as this makes it difficult when changes have to be made.

I could use the macro recorder and copy contents of cell A1 and paste it
into cell C3 in the second book and so on. But there are more than 80 cells
i want to copy from the first worksheet to the second - there is a set
pattern e.g. cell a1 to cell c3, cell a2 to cell d5 (obviously too many to
list here)

I would like some form of solution that lists the from and to cell
references on a spare worksheet and uses these lists to pass values that VBA
can loop through (struggling to gert to grips with single loops let alone
using 2 together)

Any suggestions appreciated



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Copying Data

To copy from Book1, sheet "B1Data" to Book2, sheet "B2Data". From range
values (eg A1) listed in column A starting row 2 in Book1 "Sheet1" and
to range values (eg C3) listed in column B.

Sub cpy()
Dim bk1 As Workbook
Dim bk2 As Workbook
Dim eRow As Long
Dim i As Long
Dim FCell As String
Dim TCell As String
Set bk1 = Workbooks("Book1.xls")
Set bk2 = Workbooks("Book2.xls")

With bk1.Sheets("Sheet1")
eRow = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To eRow
FCell = .Cells(i, 1).Value
TCell = .Cells(i, 2).Value
bk1.Sheets("B1Data").Range(FCell).Copy _
bk2.Sheets("B2Data").Range(TCell)
Next i
End With

End Sub

Hope this helps
Rowan

Gazza wrote:
I'm fairly new to this and am having difficulty trying to solve what to me
seems like an easy problem!!!! (spent hours on line searching)

I want to import data in specific cells from one sheet to another sheet in a
different workbook using VBA

I don't want to link the two files and I'm hoping to avoid using loads and
loads of code. (as this makes it difficult when changes have to be made.

I could use the macro recorder and copy contents of cell A1 and paste it
into cell C3 in the second book and so on. But there are more than 80 cells
i want to copy from the first worksheet to the second - there is a set
pattern e.g. cell a1 to cell c3, cell a2 to cell d5 (obviously too many to
list here)

I would like some form of solution that lists the from and to cell
references on a spare worksheet and uses these lists to pass values that VBA
can loop through (struggling to gert to grips with single loops let alone
using 2 together)

Any suggestions appreciated




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copying Data

Hey guys, I have a similar problem.

I have nearly 700 soft copies that I need several specific cells from each
book.

I think the info I am importing from are inside pivot tables in the 700
books, dont know if this will make a difference or not.

lets say I need to take C3, E7, and F4 of ecah book and paste it all in a
new book in columns A,B, and C separately.

Im looking at previous resposes by PY&Associates, JoJo, and Rowan, but I
cant seem to get it working.

Im new to macros, so thanks for all the help.

peace out~

"Rowan" wrote:

To copy from Book1, sheet "B1Data" to Book2, sheet "B2Data". From range
values (eg A1) listed in column A starting row 2 in Book1 "Sheet1" and
to range values (eg C3) listed in column B.

Sub cpy()
Dim bk1 As Workbook
Dim bk2 As Workbook
Dim eRow As Long
Dim i As Long
Dim FCell As String
Dim TCell As String
Set bk1 = Workbooks("Book1.xls")
Set bk2 = Workbooks("Book2.xls")

With bk1.Sheets("Sheet1")
eRow = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To eRow
FCell = .Cells(i, 1).Value
TCell = .Cells(i, 2).Value
bk1.Sheets("B1Data").Range(FCell).Copy _
bk2.Sheets("B2Data").Range(TCell)
Next i
End With

End Sub

Hope this helps
Rowan

Gazza wrote:
I'm fairly new to this and am having difficulty trying to solve what to me
seems like an easy problem!!!! (spent hours on line searching)

I want to import data in specific cells from one sheet to another sheet in a
different workbook using VBA

I don't want to link the two files and I'm hoping to avoid using loads and
loads of code. (as this makes it difficult when changes have to be made.

I could use the macro recorder and copy contents of cell A1 and paste it
into cell C3 in the second book and so on. But there are more than 80 cells
i want to copy from the first worksheet to the second - there is a set
pattern e.g. cell a1 to cell c3, cell a2 to cell d5 (obviously too many to
list here)

I would like some form of solution that lists the from and to cell
references on a spare worksheet and uses these lists to pass values that VBA
can loop through (struggling to gert to grips with single loops let alone
using 2 together)

Any suggestions appreciated



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Copying Data

Method is the same.
Put all 700 filenames in range and loop through each of them.

"emile" wrote:

Hey guys, I have a similar problem.

I have nearly 700 soft copies that I need several specific cells from each
book.

I think the info I am importing from are inside pivot tables in the 700
books, dont know if this will make a difference or not.

lets say I need to take C3, E7, and F4 of ecah book and paste it all in a
new book in columns A,B, and C separately.

Im looking at previous resposes by PY&Associates, JoJo, and Rowan, but I
cant seem to get it working.

Im new to macros, so thanks for all the help.

peace out~

"Rowan" wrote:

To copy from Book1, sheet "B1Data" to Book2, sheet "B2Data". From range
values (eg A1) listed in column A starting row 2 in Book1 "Sheet1" and
to range values (eg C3) listed in column B.

Sub cpy()
Dim bk1 As Workbook
Dim bk2 As Workbook
Dim eRow As Long
Dim i As Long
Dim FCell As String
Dim TCell As String
Set bk1 = Workbooks("Book1.xls")
Set bk2 = Workbooks("Book2.xls")

With bk1.Sheets("Sheet1")
eRow = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To eRow
FCell = .Cells(i, 1).Value
TCell = .Cells(i, 2).Value
bk1.Sheets("B1Data").Range(FCell).Copy _
bk2.Sheets("B2Data").Range(TCell)
Next i
End With

End Sub

Hope this helps
Rowan

Gazza wrote:
I'm fairly new to this and am having difficulty trying to solve what to me
seems like an easy problem!!!! (spent hours on line searching)

I want to import data in specific cells from one sheet to another sheet in a
different workbook using VBA

I don't want to link the two files and I'm hoping to avoid using loads and
loads of code. (as this makes it difficult when changes have to be made.

I could use the macro recorder and copy contents of cell A1 and paste it
into cell C3 in the second book and so on. But there are more than 80 cells
i want to copy from the first worksheet to the second - there is a set
pattern e.g. cell a1 to cell c3, cell a2 to cell d5 (obviously too many to
list here)

I would like some form of solution that lists the from and to cell
references on a spare worksheet and uses these lists to pass values that VBA
can loop through (struggling to gert to grips with single loops let alone
using 2 together)

Any suggestions appreciated



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
Copying rows of data into new worksheet but placing data into colu Thalarctos Excel Discussion (Misc queries) 0 June 6th 10 04:01 AM
Copying data as static as source data changes pfrost Excel Worksheet Functions 3 March 13th 06 02:52 PM
Copying Data into Column with Existing Data GZul Excel Discussion (Misc queries) 0 February 9th 06 11:30 PM
Copying Data Dan Excel Programming 1 August 26th 04 02:54 PM
Copying data down to next dirty cell, then copying that data slarson Excel Programming 0 September 15th 03 09:19 PM


All times are GMT +1. The time now is 03:42 AM.

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

About Us

"It's about Microsoft Excel"