Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open a workbook then goto a specific range
I have been searching the group to find an answer to this one, but can't find
anything that works and need some help. I have a workbook called 'WRO Summary'. Cell K4 = the current month (formatted 'mmm'). In another workbook called 'B Debt', there are named cells, 'Jan', 'Feb', 'Mar', etc. In the workbook 'WRO Summary' I have a macro that does a number of different things, but I need to do is copy a range to a specific range in 'B Debt'. I can get the macro to open the B Debt workbook, is there a way to look at cell K4 in 'WRO Summary' and go to the named range in 'B Debt'. ie: WRO Summary, Cell K4 = 'Oct', then open workbook 'B Debt' and go to range 'Oct'? Once I get to this named range, I know how to find the next blank row etc. to paste the data. Thanks for your assistance. -- Linda |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open a workbook then goto a specific range
You didn't specify the worksheet name or number so I used sheet 1 in both
workbooks. If different, change it. selRng = Workbooks("WRO Summary").Sheets(1).Range("K4").Value Workbooks("B Debt").Sheets(1).selRng.Activate "mathel" wrote: I have been searching the group to find an answer to this one, but can't find anything that works and need some help. I have a workbook called 'WRO Summary'. Cell K4 = the current month (formatted 'mmm'). In another workbook called 'B Debt', there are named cells, 'Jan', 'Feb', 'Mar', etc. In the workbook 'WRO Summary' I have a macro that does a number of different things, but I need to do is copy a range to a specific range in 'B Debt'. I can get the macro to open the B Debt workbook, is there a way to look at cell K4 in 'WRO Summary' and go to the named range in 'B Debt'. ie: WRO Summary, Cell K4 = 'Oct', then open workbook 'B Debt' and go to range 'Oct'? Once I get to this named range, I know how to find the next blank row etc. to paste the data. Thanks for your assistance. -- Linda |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open a workbook then goto a specific range
I tried your suggestion several different ways, it still doesn't recognize to
GoTo the named cell. There are multple users of the originating workbook so, I have to change directories. Here's what I have: ChDir "G:\SAVINGS" Workbooks.Open Filename:="G:\B Debt.xls" 'selRng = Workbooks("WRO Summary").Sheets("WRO Memo").Range("K4").Value It will open the workbook G:\B Debt.xls and remain in the exact cell where it was last saved. What am I doing wrong? -- Linda "JLGWhiz" wrote: You didn't specify the worksheet name or number so I used sheet 1 in both workbooks. If different, change it. selRng = Workbooks("WRO Summary").Sheets(1).Range("K4").Value Workbooks("B Debt").Sheets(1).selRng.Activate "mathel" wrote: I have been searching the group to find an answer to this one, but can't find anything that works and need some help. I have a workbook called 'WRO Summary'. Cell K4 = the current month (formatted 'mmm'). In another workbook called 'B Debt', there are named cells, 'Jan', 'Feb', 'Mar', etc. In the workbook 'WRO Summary' I have a macro that does a number of different things, but I need to do is copy a range to a specific range in 'B Debt'. I can get the macro to open the B Debt workbook, is there a way to look at cell K4 in 'WRO Summary' and go to the named range in 'B Debt'. ie: WRO Summary, Cell K4 = 'Oct', then open workbook 'B Debt' and go to range 'Oct'? Once I get to this named range, I know how to find the next blank row etc. to paste the data. Thanks for your assistance. -- Linda |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open a workbook then goto a specific range
I think I've done something similar, but rather than going to the named range
'Oct', go to the column or row labeled 'Oct', and work from the Get into 'B Debt', and select the range with the labels Jan, Feb, Mar, etc. For Each Item in Selection If Item.Text = Workbooks("WRO Summary").Sheets(1).Range("K4").Text 'your code for copying/pasting End if Next Item Application.CutCopyMode = False "mathel" wrote: I have been searching the group to find an answer to this one, but can't find anything that works and need some help. I have a workbook called 'WRO Summary'. Cell K4 = the current month (formatted 'mmm'). In another workbook called 'B Debt', there are named cells, 'Jan', 'Feb', 'Mar', etc. In the workbook 'WRO Summary' I have a macro that does a number of different things, but I need to do is copy a range to a specific range in 'B Debt'. I can get the macro to open the B Debt workbook, is there a way to look at cell K4 in 'WRO Summary' and go to the named range in 'B Debt'. ie: WRO Summary, Cell K4 = 'Oct', then open workbook 'B Debt' and go to range 'Oct'? Once I get to this named range, I know how to find the next blank row etc. to paste the data. Thanks for your assistance. -- Linda |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open a workbook then goto a specific range
Thanks for the input, it gave me an idea. I coded the file so it opens on
the worksheet for the specific month. Then within the macro, I specify the range I need and work it from there. -- Linda "DJ" wrote: I think I've done something similar, but rather than going to the named range 'Oct', go to the column or row labeled 'Oct', and work from the Get into 'B Debt', and select the range with the labels Jan, Feb, Mar, etc. For Each Item in Selection If Item.Text = Workbooks("WRO Summary").Sheets(1).Range("K4").Text 'your code for copying/pasting End if Next Item Application.CutCopyMode = False "mathel" wrote: I have been searching the group to find an answer to this one, but can't find anything that works and need some help. I have a workbook called 'WRO Summary'. Cell K4 = the current month (formatted 'mmm'). In another workbook called 'B Debt', there are named cells, 'Jan', 'Feb', 'Mar', etc. In the workbook 'WRO Summary' I have a macro that does a number of different things, but I need to do is copy a range to a specific range in 'B Debt'. I can get the macro to open the B Debt workbook, is there a way to look at cell K4 in 'WRO Summary' and go to the named range in 'B Debt'. ie: WRO Summary, Cell K4 = 'Oct', then open workbook 'B Debt' and go to range 'Oct'? Once I get to this named range, I know how to find the next blank row etc. to paste the data. Thanks for your assistance. -- Linda |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Open a new workbook with a specific name | Excel Discussion (Misc queries) | |||
Open a specific workbook...find value from other open workbook and then insert cells values in cell next to it. | Excel Programming | |||
Open Specific Sheet in Workbook | Excel Programming | |||
Open workbook to specific worksheet | Excel Discussion (Misc queries) | |||
Check sheets name and open goto workbook | Excel Programming |