Posted By: Anonymous
How do I activate my Other workbook from the Current workbook? I have a current workbook with dumb.xls and The other workbook name as Tire.xls.I have opened the Tire.xls from the dumb.xls using
worksbooks.open filename:= "name of the file".Its getting open but The problem is Im unable to make it work.
If I say
cells(2,24).value=24 puts these value in the cell of dumb.xls but I want it to be done one Tire.xls.
activesheet.cells(2,24).value=24 puts these on Tire.xls. But how do i activate the Workbook with the name ? I need to open 3 to 4 excel workbooks And perform the operation? How do I activate the specific workbook
I have found this code on google
activeworkbook.worksheet("sheetname").activate ' but not working windows("sheetname").activate ' people on google suggested not to use
Its not getting activated. I dont know how to make it work. Can anyone tell me How do i activate a specific workbook and a specific sheet of the other workbook ?
Example: I have niko.xls and niko_2.xls opened as workbooks from the dumb.xls workbook so totally 3 workbooks and I have to activate the 2nd sheet of niko_2.xls workbook.How do I make it? Can anyone explain me the syntax with these example? Thank you in advance
You do not need to activate the sheet (you’ll take a huge performance hit for doing so, actually). Since you are declaring an object for the sheet, when you call the method starting with “wb.” you are selecting that object. For example, you can jump in between workbooks without activating anything like here:
Sub Test() Dim wb1 As Excel.Workbook Set wb1 = Workbooks.Open("C:Documents and Settings✘✘✘xDesktoptest1.xls") Dim wb2 As Excel.Workbook Set wb2 = Workbooks.Open("C:Documents and Settings✘✘✘xDesktoptest2.xls") wb1.Sheets("Sheet1").Cells(1, 1).Value = 24 wb2.Sheets("Sheet1").Cells(1, 1).Value = 24 wb1.Sheets("Sheet1").Cells(2, 1).Value = 54 End Sub