how to refer to a non active workbook in VBA???

Mav93

Board Regular
Joined
Feb 21, 2005
Messages
107
Hi everyone !!!!!
is there a way to refer to a non active workbook
I know this code isn't correct but may you can get the idea

Active workbook("Olson Bros Bid Information Sheet.xls").sheets("data").range("A1").value = NonActive workbook("take off forms")Sheets("cost sheet").range("A1")


please let me know if I'm way off I'm still pretty new to VBA
thanks for the help!!!!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
Just change Workbook to Workbooks.
Code:
Workbooks("Olson Bros Bid Information Sheet.xls").sheets("data").range("A1").Value = Workbooks("take off forms")Sheets("cost sheet").range("A1")
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,454
Hello Mav93
There are a couple ways to do that. Norie has pointed out the most common
and (in my opinion) the best.
To do it using ActiveWorkbook though you could use this.
Code:
ActiveWorkbook.Sheets("data").Range("A1").Value = _
  Workbooks("take off forms").Sheets("cost sheet").Range("A1").Value
 

Mav93

Board Regular
Joined
Feb 21, 2005
Messages
107
Thanks half ace and norie actually I ended up using both of the codes that you provided.


Thanks again
 

Forum statistics

Threads
1,136,600
Messages
5,676,727
Members
419,647
Latest member
usas12gthr

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
Top