Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
X-Axis Frustration Dave Charts and Charting in Excel 2 July 18th 08 01:57 AM
Solver Frustration zealot Excel Discussion (Misc queries) 1 November 10th 06 12:58 PM
Vlookup Frustration Dave F Excel Worksheet Functions 2 September 27th 06 02:43 PM
Vlookup Frustration Pete_UK Excel Worksheet Functions 0 September 27th 06 01:37 PM
Commandbar frustration. Julian Cox Excel Programming 6 July 23rd 04 08:57 PM


All times are GMT +1. The time now is 11:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"