ctrl back and forth to work books

mallikagattala

New Member
Joined
Jun 26, 2008
Messages
2
Sub test()
Dim appexcel As Object
Set appexcel = CreateObject("excel.application")
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.Show
fname = .SelectedItems(1)
End With
appexcel.Workbooks.Open (fname)
appexcel.Visible = True

appexcel.Worksheets("Sheet1").Select
appexcel.Range("D4").Select
take = appexcel.ActiveCell 'take is having location of l

appexcel.Range(take).Select
l = appexcel.ActiveCell
If l = 22 Then
MsgBox "i am happy "
End If

End Sub

there are 2 workbooks work book1 and workbook 2 ...workbook 1 has values ....whose positions may be changing ...so the user stores their position or ranges in workbook2 (which are fixed)....like cell in work book2 has locations of various parameters in workbook1....i have to store this location(say may be PQ) and open the workbook and print range("PQ") of workbook1 i have problems in getting controls back and forth to 2 workbooks and i am using vbe of workbook1...
i am new to vb ....so please be very descriptive in answering this
thanks a lot
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,191,371
Messages
5,986,264
Members
440,015
Latest member
knijgh

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