Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ren Ren is offline
external usenet poster
 
Posts: 67
Default Copying Values to another Workbook

I want to use a macro so that evertime i run an analysis tool in a workbook,
I can copy the data into another file. So my questions are

1) Can I accomplish this without opening the other (index) file. The only
method I know right now is to do something like Windows("Index.xls).Activate
,etc. Is there some way I can automactially open the file?

2)The data added would be appended at the last row of the index file. How
should I accomlish this? I think I would need a FOR loop and a cell<""
check, but how would specify that the macro only looks down one column?
i.e. I would want it to look down column A and skip row 1-10 and then check
against each cell value to see if there's any value that exists in the cell.

3) How do I copy absolute values. ActiveCell = "=[Filename.xls]Main!R3C3"
would give me a link, but I just need the absolute values.

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Copying Values to another Workbook

Maybe this ?
http://www.rondebruin.nl/copy1.htm

See the last example that use another workbook

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ren" wrote in message ...
I want to use a macro so that evertime i run an analysis tool in a workbook,
I can copy the data into another file. So my questions are

1) Can I accomplish this without opening the other (index) file. The only
method I know right now is to do something like Windows("Index.xls).Activate
,etc. Is there some way I can automactially open the file?

2)The data added would be appended at the last row of the index file. How
should I accomlish this? I think I would need a FOR loop and a cell<""
check, but how would specify that the macro only looks down one column?
i.e. I would want it to look down column A and skip row 1-10 and then check
against each cell value to see if there's any value that exists in the cell.

3) How do I copy absolute values. ActiveCell = "=[Filename.xls]Main!R3C3"
would give me a link, but I just need the absolute values.

Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
Ren Ren is offline
external usenet poster
 
Posts: 67
Default Copying Values to another Workbook

Thanks,

I do have a few problems though.
VBA doesn't seemt o recognize bIsBookOpen()

How do I copy single cell values

destWB.Worksheets("Index").Cell("A" & Lr).Value =
sourceWB.Worksheets("Main").Cell("C3")

gives me an error message.

As does

Set destrange = destWB.Worksheets("Index").Range("D" & Lr)



"Ron de Bruin" wrote:

Maybe this ?
http://www.rondebruin.nl/copy1.htm

See the last example that use another workbook

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ren" wrote in message ...
I want to use a macro so that evertime i run an analysis tool in a workbook,
I can copy the data into another file. So my questions are

1) Can I accomplish this without opening the other (index) file. The only
method I know right now is to do something like Windows("Index.xls).Activate
,etc. Is there some way I can automactially open the file?

2)The data added would be appended at the last row of the index file. How
should I accomlish this? I think I would need a FOR loop and a cell<""
check, but how would specify that the macro only looks down one column?
i.e. I would want it to look down column A and skip row 1-10 and then check
against each cell value to see if there's any value that exists in the cell.

3) How do I copy absolute values. ActiveCell = "=[Filename.xls]Main!R3C3"
would give me a link, but I just need the absolute values.

Thanks in advance




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Copying Values to another Workbook

Hi Ren

Read this below the macro

**Copy this function together with the LastRow function in the module**
Copy this also in the module

Function bIsBookOpen(ByRef szBookName As String) As Boolean
' Rob Bovey
On Error Resume Next
bIsBookOpen = Not (Application.Workbooks(szBookName) Is Nothing)
End Function


Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ren" wrote in message ...
Thanks,

I do have a few problems though.
VBA doesn't seemt o recognize bIsBookOpen()

How do I copy single cell values

destWB.Worksheets("Index").Cell("A" & Lr).Value =
sourceWB.Worksheets("Main").Cell("C3")

gives me an error message.

As does

Set destrange = destWB.Worksheets("Index").Range("D" & Lr)



"Ron de Bruin" wrote:

Maybe this ?
http://www.rondebruin.nl/copy1.htm

See the last example that use another workbook

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ren" wrote in message ...
I want to use a macro so that evertime i run an analysis tool in a workbook,
I can copy the data into another file. So my questions are

1) Can I accomplish this without opening the other (index) file. The only
method I know right now is to do something like Windows("Index.xls).Activate
,etc. Is there some way I can automactially open the file?

2)The data added would be appended at the last row of the index file. How
should I accomlish this? I think I would need a FOR loop and a cell<""
check, but how would specify that the macro only looks down one column?
i.e. I would want it to look down column A and skip row 1-10 and then check
against each cell value to see if there's any value that exists in the cell.

3) How do I copy absolute values. ActiveCell = "=[Filename.xls]Main!R3C3"
would give me a link, but I just need the absolute values.

Thanks in advance






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
formula for copying values from one workbook to another ClareNaish Excel Worksheet Functions 1 October 3rd 06 03:07 PM
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook burl_rfc Excel Programming 1 April 1st 06 08:48 PM
copying values only from another workbook mwc0914[_13_] Excel Programming 1 March 8th 06 05:03 PM
Copying values from one Workbook to Another Kevin H. Stecyk[_2_] Excel Programming 2 October 2nd 05 08:36 PM
copying values form one workbook to other dreamer[_20_] Excel Programming 0 July 9th 04 10:57 AM


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