Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA frustration
Can someone tell me why this doesn't work? Thanks!
Sub Test() a = Worksheets("Sheet1").Range("A7") b = Cells.Find("Total", , xlValues).Address Worksheets("Sheet1").Range(a, b).Select End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA frustration
Hi
what are you trying to do? - a contains the vALUE from cell A7 (whatever is in this cell - b contains the address of the found cell -- Regards Frank Kabel Frankfurt, Germany Mark1 wrote: Can someone tell me why this doesn't work? Thanks! Sub Test() a = Worksheets("Sheet1").Range("A7") b = Cells.Find("Total", , xlValues).Address Worksheets("Sheet1").Range(a, b).Select End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA frustration
Frank,
Once again you saved the day. I think you answered my question. I need to use the Set keyword. I'm trying to select the area between A1 and where the value of the found cell is equal to "Total". So, if I say: Set a=Worksheets("Sheet1").Range("A1") that should make it work, right? "Frank Kabel" wrote: Hi what are you trying to do? - a contains the vALUE from cell A7 (whatever is in this cell - b contains the address of the found cell -- Regards Frank Kabel Frankfurt, Germany Mark1 wrote: Can someone tell me why this doesn't work? Thanks! Sub Test() a = Worksheets("Sheet1").Range("A7") b = Cells.Find("Total", , xlValues).Address Worksheets("Sheet1").Range(a, b).Select End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA frustration
If you know the address of the starting cell, you can specify it literally,
i.e. Sub Test() b = Cells.Find("Total", , xlValues).Address Worksheets("Sheet1").Range("A1", b).Select End Sub or, since the arguments to Range can be range *objects* as well as string addresses, Sub Test() Set b = Cells.Find("Total", , xlValues) With Worksheets("Sheet1") .Range(Cells(1), b).Select End With End Sub In the 2nd example, you could also use "A1" instead of Cells(1) On Mon, 25 Oct 2004 11:34:23 -0700, "Mark1" wrote: Frank, Once again you saved the day. I think you answered my question. I need to use the Set keyword. I'm trying to select the area between A1 and where the value of the found cell is equal to "Total". So, if I say: Set a=Worksheets("Sheet1").Range("A1") that should make it work, right? "Frank Kabel" wrote: Hi what are you trying to do? - a contains the vALUE from cell A7 (whatever is in this cell - b contains the address of the found cell -- Regards Frank Kabel Frankfurt, Germany Mark1 wrote: Can someone tell me why this doesn't work? Thanks! Sub Test() a = Worksheets("Sheet1").Range("A7") b = Cells.Find("Total", , xlValues).Address Worksheets("Sheet1").Range(a, b).Select End Sub |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA frustration
Hi
yes it should -- Regards Frank Kabel Frankfurt, Germany Mark1 wrote: Frank, Once again you saved the day. I think you answered my question. I need to use the Set keyword. I'm trying to select the area between A1 and where the value of the found cell is equal to "Total". So, if I say: Set a=Worksheets("Sheet1").Range("A1") that should make it work, right? "Frank Kabel" wrote: Hi what are you trying to do? - a contains the vALUE from cell A7 (whatever is in this cell - b contains the address of the found cell -- Regards Frank Kabel Frankfurt, Germany Mark1 wrote: Can someone tell me why this doesn't work? Thanks! Sub Test() a = Worksheets("Sheet1").Range("A7") b = Cells.Find("Total", , xlValues).Address Worksheets("Sheet1").Range(a, b).Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
X-Axis Frustration | Charts and Charting in Excel | |||
Solver Frustration | Excel Discussion (Misc queries) | |||
Vlookup Frustration | Excel Worksheet Functions | |||
Vlookup Frustration | Excel Worksheet Functions | |||
Commandbar frustration. | Excel Programming |