Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Having troubles using visual basic to paste info from one workbook to another


I'm trying to paste info from one workbook to another, but don't kno
much about writing macros. I'm just adjusting another macro to do wha
I need it to do. Here is the working macro I have so far:

Dim Markone As String
Dim Marktwo As String
Dim Markthree As String
Dim Markfour As String
Dim Markfive As String
Dim NewRow As String

Markone = Range("A12").Value
Marktwo = Range("A13").Value
Markthree = Range("A14").Value
Markfour = Range("A15").Value
Markfive = Range("A16").Value

With Worksheets("GIRDER")
.Cells(12, 1).Value = Markone
.Cells(14, 1).Value = Marktwo
.Cells(16, 1).Value = Markthree
.Cells(18, 1).Value = Markfour
.Cells(20, 1).Value = Markfive

End With

End Sub

I tried typing in "With Workbook("NEW_BOM")" above the "Wit
Worksheets("GIRDER")" But didn't work. The macro works fine in th
same workbook, but just don't know what to type in to make it go to th
other workbook named "BOM_NEW".

Any help is appreciated

--
dl
-----------------------------------------------------------------------
dlb's Profile: http://www.excelforum.com/member.php...fo&userid=1648
View this thread: http://www.excelforum.com/showthread.php?threadid=38280

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Having troubles using visual basic to paste info from one workbook to another


i am assuming that NEW_BOM.xls is the workbook to which you want to cop
the values.

And macro is in the workbook from which you want to copy.

NEW_BOM.xls file has to be opened for this macro to work or
alternately you can write to open it and execute this macro.



Dim Markone As String
Dim Marktwo As String
Dim Markthree As String
Dim Markfour As String
Dim Markfive As String
Dim NewRow As String
Markone = Range("A12").Value
Marktwo = Range("A13").Value
Markthree = Range("A14").Value
Markfour = Range("A15").Value
Markfive = Range("A16").Value
With Workbooks("NEW_BOM.xls").Worksheets("GIRDER")
.Cells(12, 1).Value = Markone
.Cells(14, 1).Value = Marktwo
.Cells(16, 1).Value = Markthree
.Cells(18, 1).Value = Markfour
.Cells(20, 1).Value = Markfive

End With

End Su

--
anilsolipura
-----------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...fo&userid=1627
View this thread: http://www.excelforum.com/showthread.php?threadid=38280

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Having troubles using visual basic to paste info from one workbook to another


untested, but a couple things you could try:

First, instead of referencing a cell ("A12"), give the cell a Rang
Name (markone) and use that in your code:

Markone = Range("markone").Value
this has the advantage of not requiring the sheet name to identify
this may only work within the same workbook.

Second choice, use the workbook and sheet name in your reference:

Markone = Range("[BOM_NEW]sheet1!A12").Value

Of course, adjust references as needed...

HTH

Bruc

--
swatsp0

-----------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...fo&userid=1510
View this thread: http://www.excelforum.com/showthread.php?threadid=38280

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Having troubles using visual basic to paste info from one workbook to another


Thank you! Was missing the .xl

--
dl
-----------------------------------------------------------------------
dlb's Profile: http://www.excelforum.com/member.php...fo&userid=1648
View this thread: http://www.excelforum.com/showthread.php?threadid=38280

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 and paste (visual basic) ian123 New Users to Excel 1 June 8th 06 12:22 AM
help to paste via visual basic ian123 New Users to Excel 1 June 8th 06 12:13 AM
visual basic (copy and paste) ian123 Excel Worksheet Functions 2 June 7th 06 11:26 PM
How to hide a workbook and to detect a hidden workbook in visual basic jn1971[_3_] Excel Programming 0 May 5th 04 10:08 PM
Saving Workbook in Visual Basic Hides the Worksheet, Why bmartin52 Excel Programming 0 January 10th 04 06:33 PM


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