ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.inputbox for another workbook (https://www.excelbanter.com/excel-programming/372465-application-inputbox-another-workbook.html)

Utkarsh

Application.inputbox for another workbook
 
Hi

I need to select two ranges. One range comes from the current workbook.
Another from a separate workbook. The following code helps me select
ranges from different worksheets within the same workbook but I cannot
seem to move to another workbook.

What could be going wrong?

Please help!

Thanks
Utkarsh
*****************
Sub comp1()


Dim FirstRange As Range
Dim SecondRange As Range

'snip snip

Set FirstRange = Application.InputBox("Set first series: ", Type:=8)
Set SecondRange = Application.InputBox("Set Second series: ",
Type:=8)

'snip snip

end sub


Die_Another_Day

Application.inputbox for another workbook
 
Add this:
Workbooks("Yourbook2.xls").Activate
Between the to input box statements.
and this after the second inputbox statement:
Thisworkbook.Activate

Charles Chickering

Utkarsh wrote:
Hi

I need to select two ranges. One range comes from the current workbook.
Another from a separate workbook. The following code helps me select
ranges from different worksheets within the same workbook but I cannot
seem to move to another workbook.

What could be going wrong?

Please help!

Thanks
Utkarsh
*****************
Sub comp1()


Dim FirstRange As Range
Dim SecondRange As Range

'snip snip

Set FirstRange = Application.InputBox("Set first series: ", Type:=8)
Set SecondRange = Application.InputBox("Set Second series: ",
Type:=8)

'snip snip

end sub



Utkarsh

Application.inputbox for another workbook
 
Thanks Die_Another_Day

In my case the file name and location keeps changes. Would appreciate a
more general solution.



All times are GMT +1. The time now is 05:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com