Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to reference a named area
HI, programming in excel VBA, how can I make reference to and area I define,
example I name the area D5 to F10 and I call it Salary, how can I read the information in the cell D5 or E8 from VBA. Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to reference a named area
try:
MsgBox Range("Salary")(1, 1).Value MsgBox Range("Salary")(4, 2).Value "Orlando" wrote: HI, programming in excel VBA, how can I make reference to and area I define, example I name the area D5 to F10 and I call it Salary, how can I read the information in the cell D5 or E8 from VBA. Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to reference a named area
Hi orlando,
I'm not sure if you are referring to a range which you have named in the interactive mode or a range to which you have assigned to a variable in VBA. I suggest that you copy the following code into a blank workbook and check out what it all does. Macro1 starts with recorded code of naming a range while working on the worksheet. The Named range could have been created previously but I have put it in the macro so that you have the range named properly for the following code. Run the macros in order by number. Macro2 then puts some data in the cells in the named range. Note that the named range is like a mini worksheet within a worksheet and the cells start on row1, column 1 of the named range. When using the cells function, note that the row number is first and the column number second. Cells(RowNumber, ColumnNumber). This is opposite to range("A1") where column number is first. Comments in the other macros say what they do. I have included code which inserts data, reads data and loops through all the cells in the range. Macro5: Lastly, I have included code to assign a range to a VBA variable and then loop through the cells and write data to them. Hope this helps and feel free to get back to me if you have any more questions. Regards, OssieMac "Orlando" wrote: HI, programming in excel VBA, how can I make reference to and area I define, example I name the area D5 to F10 and I call it Salary, how can I read the information in the cell D5 or E8 from VBA. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy contents of a named range to a section on working area | Excel Discussion (Misc queries) | |||
Using named range to extend print area for variable number of columns | Excel Worksheet Functions | |||
Excel2000:How to link Print Area with a named range | Excel Discussion (Misc queries) | |||
Excel2000:How to link Print Area with a named range | Excel Worksheet Functions | |||
Fill a combo box from a named area on a sheet | Excel Programming |