Look a the value of the current cell on the other worksheet

ermccarthy

Board Regular
Joined
Feb 15, 2002
Messages
224
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
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Would this do the trick?

exch = Windows("Rates").ActiveCell.Address
Windows("GLEIS.DBF").Activate
Range(exch).Select
 
Upvote 0
When I run this it give me a runtime error 9: Subscript out of range. The debugger highlights the exch= line.

Any Ideas?
 
Upvote 0
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
 
Upvote 0
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....
 
Upvote 0
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??
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,570
Messages
6,120,294
Members
448,953
Latest member
Dutchie_1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top