![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: San Antonio, TX
Posts: 186
|
I have written a small macro that I want it to look the value of the Active cell from one workbook on a second workbook, but I am have no luck......This is what I have, if it leave my value just to say Active cell, when you switch windows, the value changes. But I can't seem to get it to work using the following command either. What am I doing wrong??
exch = Windows("Rates").ActiveCell.Value Windows("GLEIS.DBF").Activate Range("A2").Select Do Until ActiveCell = (exch) ActiveCell.Offset(1, 0).Select Loop |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Apr 2002
Location: Kissimmee, Florida
Posts: 384
|
Would this do the trick?
exch = Windows("Rates").ActiveCell.Address Windows("GLEIS.DBF").Activate Range(exch).Select
__________________
Hope This Helps. Sean. Digest of Homes WinXP, XL XP |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: San Antonio, TX
Posts: 186
|
When I run this it give me a runtime error 9: Subscript out of range. The debugger highlights the exch= line.
Any Ideas?
__________________
Russell |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Apr 2002
Location: Kissimmee, Florida
Posts: 384
|
I just copied and pasted your version without looking closely enough...you were using another workbook I supplied the code for a range call. The code below works for standard sheet names change as needed.
Sub Test_Me() exch = Windows("Book1").ActiveCell.Address Windows("Book2").Activate Range(exch).Select End Sub
__________________
Hope This Helps. Sean. Digest of Homes WinXP, XL XP |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Ever thought of using the INDIRECT function?
__________________
Kind regards, Al Chara |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Feb 2002
Location: San Antonio, TX
Posts: 186
|
exch = Windows("Rates").ActiveCell.Address
Windows("GLEIS.DBF").Activate Range(exch).Select This is the formula I have, but it still gives me the same runtime error....I don't know what I am doing wrong....
__________________
Russell |
|
|
|
|
|
#7 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
You need an extension on Rates:
exch = Windows("Rates.xls").ActiveCell.Address
__________________
Kind regards, Al Chara |
|
|
|
|
|
#8 |
|
Board Regular
Join Date: Feb 2002
Location: San Antonio, TX
Posts: 186
|
OK GREAT!!!! Almost there....When I do this puts me at the same Address of the Rate.xls Active Cell, but what I am trying to accomplish is to search for the Value of the Active Cell on the Rate sheet say 950 which is located somewhere in Column A of the 2nd file. Any Ideas??
|
|
|
|
|
|
#9 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Try the following:
With Workbooks("GLEIS.xls").Worksheets("Sheet1").Columns(1) Set c = .Find(Windows("Rates.xls").ActiveCell) End With Windows("GLEIS.xls").Activate ActiveSheet.Range(c.Address).Select replace GLEIS.xls with GLEIS.DBF or whatever.
__________________
Kind regards, Al Chara |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|