Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
clk clk is offline
external usenet poster
 
Posts: 17
Default Macro for Copying Data

I have two spreadsheets. I need to copy a cell from one spreadsheet,
go to the other spreadsheet and find the number in that one and then
copy the contents of another cell back to the original spreadsheet.

Here is the code I have which works but requires some hands on copying
and pasting.

Dim strToFind As String
Selection.Copy
strToFind = InputBox("Enter the code to find")
' TRIED TO GET THE ITEM I COPIED TO PASTE BUT I MANUALLY HAVE TO
HIT CTRL + V TO PASTE
INTO INPUT BOX AND THEN CLICK OK. I WANT THIS STEP AUTOMATED.
'Selection.Paste
Windows("Full GL Mapping Oracle to SOS EDITED.xls").Activate
Columns("L:L").Select
Selection.Find(what:=strToFind, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, -3).Select
Selection.Copy
Windows("2005 beginningbalancesglpost2.fil.xls").Activate
ActiveCell.Offset(0, 1).Select
ActiveSheet.Paste

Any other suggestions would be greatly appreciated. I recorded this
macro and then started tweaking it. I am open to any and all
suggestions.

Thank you.

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

How about assigning the value from the old cell to a temp variable then
assigning the temp variable to the new cell.

TempValue = Sheet1.Cells(1,1).Value

Sheet2.Cells(1,1).Value = TempValue


The above will copy the value from A1 on sheet1 to A1 on sheet2.

--
Rui

"clk" wrote in message
...
I have two spreadsheets. I need to copy a cell from one spreadsheet,
go to the other spreadsheet and find the number in that one and then
copy the contents of another cell back to the original spreadsheet.

Here is the code I have which works but requires some hands on copying
and pasting.

Dim strToFind As String
Selection.Copy
strToFind = InputBox("Enter the code to find")
' TRIED TO GET THE ITEM I COPIED TO PASTE BUT I MANUALLY HAVE TO
HIT CTRL + V TO PASTE
INTO INPUT BOX AND THEN CLICK OK. I WANT THIS STEP AUTOMATED.
'Selection.Paste
Windows("Full GL Mapping Oracle to SOS EDITED.xls").Activate
Columns("L:L").Select
Selection.Find(what:=strToFind, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, -3).Select
Selection.Copy
Windows("2005 beginningbalancesglpost2.fil.xls").Activate
ActiveCell.Offset(0, 1).Select
ActiveSheet.Paste

Any other suggestions would be greatly appreciated. I recorded this
macro and then started tweaking it. I am open to any and all
suggestions.

Thank you.



  #3   Report Post  
Posted to microsoft.public.excel.programming
clk clk is offline
external usenet poster
 
Posts: 17
Default Macro for Copying Data

On Oct 29, 1:50*pm, "ruic" wrote:
How about assigning the value from the old cell to a temp variable then
assigning the temp variable to the new cell.

TempValue = Sheet1.Cells(1,1).Value

Sheet2.Cells(1,1).Value = TempValue

The above will copy the value from A1 on sheet1 to A1 on sheet2.

--
Rui

"clk" wrote in message

...



I have two spreadsheets. *I need to copy a cell from one spreadsheet,
go to the other spreadsheet and find the number in that one and then
copy the contents of another cell back to the original spreadsheet.


Here is the code I have which works but requires some hands on copying
and pasting.


* Dim strToFind As String
* *Selection.Copy
* *strToFind = InputBox("Enter the code to find")
* ' TRIED TO GET THE ITEM I COPIED TO PASTE BUT I MANUALLY HAVE TO
HIT CTRL + V TO PASTE
* *INTO INPUT BOX AND THEN CLICK OK. *I WANT THIS STEP AUTOMATED.
* *'Selection.Paste
* *Windows("Full GL Mapping Oracle to SOS EDITED.xls").Activate
* *Columns("L:L").Select
* *Selection.Find(what:=strToFind, After:=ActiveCell, LookIn:= _
* * * *xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:= _
* * * *xlNext, MatchCase:=False, SearchFormat:=False).Activate
* *ActiveCell.Offset(0, -3).Select
* *Selection.Copy
* *Windows("2005 beginningbalancesglpost2.fil.xls").Activate
* *ActiveCell.Offset(0, 1).Select
* *ActiveSheet.Paste


Any other suggestions would be greatly appreciated. *I recorded this
macro and then started tweaking it. *I am open to any and all
suggestions.


Thank you.- Hide quoted text -


- Show quoted text -



I tried changing it but then when it runs it has TempValue = true. I
will need to run this many times on one spreadsheet. I can't assign a
specific cell in the code.

Dim TempValue As String

TempValue = Selection.Copy
Windows("Full GL Mapping Oracle to SOS EDITED.xls").Activate
Columns("L:L").Select
Selection.Find(what:=TempValue, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, -3).Select
Selection.Copy
Windows("2005 beginningbalancesglpost2.fil.xls").Activate
ActiveCell.Offset(0, 1).Select
ActiveSheet.Paste
  #4   Report Post  
Posted to microsoft.public.excel.programming
clk clk is offline
external usenet poster
 
Posts: 17
Default Macro for Copying Data

On Oct 29, 2:08*pm, clk wrote:
On Oct 29, 1:50*pm, "ruic" wrote:





How about assigning the value from the old cell to a temp variable then
assigning the temp variable to the new cell.


TempValue = Sheet1.Cells(1,1).Value


Sheet2.Cells(1,1).Value = TempValue


The above will copy the value from A1 on sheet1 to A1 on sheet2.


--
Rui


"clk" wrote in message


....


I have two spreadsheets. *I need to copy a cell from one spreadsheet,
go to the other spreadsheet and find the number in that one and then
copy the contents of another cell back to the original spreadsheet.


Here is the code I have which works but requires some hands on copying
and pasting.


* Dim strToFind As String
* *Selection.Copy
* *strToFind = InputBox("Enter the code to find")
* ' TRIED TO GET THE ITEM I COPIED TO PASTE BUT I MANUALLY HAVE TO
HIT CTRL + V TO PASTE
* *INTO INPUT BOX AND THEN CLICK OK. *I WANT THIS STEP AUTOMATED.
* *'Selection.Paste
* *Windows("Full GL Mapping Oracle to SOS EDITED.xls").Activate
* *Columns("L:L").Select
* *Selection.Find(what:=strToFind, After:=ActiveCell, LookIn:= _
* * * *xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:= _
* * * *xlNext, MatchCase:=False, SearchFormat:=False).Activate
* *ActiveCell.Offset(0, -3).Select
* *Selection.Copy
* *Windows("2005 beginningbalancesglpost2.fil.xls").Activate
* *ActiveCell.Offset(0, 1).Select
* *ActiveSheet.Paste


Any other suggestions would be greatly appreciated. *I recorded this
macro and then started tweaking it. *I am open to any and all
suggestions.


Thank you.- Hide quoted text -


- Show quoted text -


I tried changing it but then when it runs it has TempValue = true. *I
will need to run this many times on one spreadsheet. *I can't assign a
specific cell in the code.

Dim TempValue As String

* * TempValue = Selection.Copy
* * Windows("Full GL Mapping Oracle to SOS EDITED.xls").Activate
* * Columns("L:L").Select
* * Selection.Find(what:=TempValue, After:=ActiveCell, LookIn:= _
* * * * xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:= _
* * * * xlNext, MatchCase:=False, SearchFormat:=False).Activate
* * ActiveCell.Offset(0, -3).Select
* * Selection.Copy
* * Windows("2005 beginningbalancesglpost2.fil.xls").Activate
* * ActiveCell.Offset(0, 1).Select
* * ActiveSheet.Paste- Hide quoted text -

- Show quoted text -


I got it working. Thanks for the help. Here is the code that works.

Dim TempValue As String

Selection.Copy
TempValue = Selection
Windows("Full GL Mapping Oracle to SOS EDITED.xls").Activate
Columns("L:L").Select
Selection.Find(what:=TempValue, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, -3).Select
Selection.Copy
Windows("2005 beginningbalancesglpost2.fil.xls").Activate
ActiveCell.Offset(0, 1).Select
ActiveSheet.Paste
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
A better Macro for Copying Data drinese18 Excel Programming 2 April 8th 08 07:20 PM
macro error - copying data twice Gretta Excel Discussion (Misc queries) 1 April 6th 07 08:14 PM
Macro Help - Copying and appending data Louis Markowski Excel Worksheet Functions 1 September 16th 05 06:53 PM
Macro Help - copying specific data Dave Excel Programming 1 April 22nd 05 07:08 AM
Copying data ranges in a macro Chris B.[_2_] Excel Programming 1 December 9th 03 02:44 AM


All times are GMT +1. The time now is 05:53 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"