Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Simple Problem?

I need to activate a range using some variables - like so:
range("("f" & c.row):("f" & tendr)").Activate

I've tried every combination I can think of, over and over again, but
nothing I can come up with will work. Can someone help me, please?




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 341
Default Simple Problem?

This works. You should be able to figure it out from this. Lose the colon.

Sub animals()

frog = "B"
cow = "1"
horse = "C"
sheep = 6

Range((frog & cow), (horse & sheep)).Select

End Sub
--
Allllen


"Ed" wrote:

I need to activate a range using some variables - like so:
range("("f" & c.row):("f" & tendr)").Activate

I've tried every combination I can think of, over and over again, but
nothing I can come up with will work. Can someone help me, please?





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Simple Problem?

Put everything inside a string. In your example, the quotes and
parenthesis are all out of place, and you aren't putting the colon
within the string.

For example, using your example, try this:

dim r as string
r = "f" + cstr (c.row) + ":" + "f" + cstr (tendr)

call activesheet.range (r).select

Hope this helps,
Dom



Ed wrote:
I need to activate a range using some variables - like so:
range("("f" & c.row):("f" & tendr)").Activate

I've tried every combination I can think of, over and over again, but
nothing I can come up with will work. Can someone help me, please?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Simple Problem?

One mo

range(cells(c.row,"F"),cells(tendr,"F")).activate



Ed wrote:

I need to activate a range using some variables - like so:
range("("f" & c.row):("f" & tendr)").Activate

I've tried every combination I can think of, over and over again, but
nothing I can come up with will work. Can someone help me, please?


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Simple Problem?

Thanks, Dom for your help. Works great. I really struggled with it before
posting.


wrote in message
oups.com...
Put everything inside a string. In your example, the quotes and
parenthesis are all out of place, and you aren't putting the colon
within the string.

For example, using your example, try this:

dim r as string
r = "f" + cstr (c.row) + ":" + "f" + cstr (tendr)

call activesheet.range (r).select

Hope this helps,
Dom



Ed wrote:
I need to activate a range using some variables - like so:
range("("f" & c.row):("f" & tendr)").Activate

I've tried every combination I can think of, over and over again, but
nothing I can come up with will work. Can someone help me, please?






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Simple Problem?

This is one of the cool things about newsgroups. I never knew that the
following would work:

1. range ("A1", "C1") -- I thought the colon was needed.
2. range (cells (1, "A"), cells(2, "A") -- I thought CELLS needed long
arguments.


Dom


Ed wrote:
I need to activate a range using some variables - like so:
range("("f" & c.row):("f" & tendr)").Activate

I've tried every combination I can think of, over and over again, but
nothing I can come up with will work. Can someone help me, please?


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Simple Problem?

#2. Nope. Excel/VBA will work nicely with longs or strings in that column
field.

Range("a1:C1") would need the colon.


" wrote:

This is one of the cool things about newsgroups. I never knew that the
following would work:

1. range ("A1", "C1") -- I thought the colon was needed.
2. range (cells (1, "A"), cells(2, "A") -- I thought CELLS needed long
arguments.

Dom

Ed wrote:
I need to activate a range using some variables - like so:
range("("f" & c.row):("f" & tendr)").Activate

I've tried every combination I can think of, over and over again, but
nothing I can come up with will work. Can someone help me, please?


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Simple Problem?

My thanks to Dave also. Newsgroups are great - nearly always learn something
new after I post.

"Dave Peterson" wrote in message
...
#2. Nope. Excel/VBA will work nicely with longs or strings in that
column
field.

Range("a1:C1") would need the colon.


" wrote:

This is one of the cool things about newsgroups. I never knew that the
following would work:

1. range ("A1", "C1") -- I thought the colon was needed.
2. range (cells (1, "A"), cells(2, "A") -- I thought CELLS needed long
arguments.

Dom

Ed wrote:
I need to activate a range using some variables - like so:
range("("f" & c.row):("f" & tendr)").Activate

I've tried every combination I can think of, over and over again, but
nothing I can come up with will work. Can someone help me, please?


--

Dave Peterson



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
Simple IF problem Trevor Aiston[_2_] Excel Worksheet Functions 0 September 12th 09 03:18 PM
Simple problem, simple formula, no FUNCTION ! Ron@Buy Excel Worksheet Functions 6 September 28th 07 04:51 PM
Simple IF problem Old Timer Excel Discussion (Misc queries) 1 November 7th 06 02:11 AM
another simple problem... London Excel Worksheet Functions 8 July 22nd 05 08:43 PM
Simple VBA problem Grant[_7_] Excel Programming 3 November 9th 04 11:00 PM


All times are GMT +1. The time now is 11:35 PM.

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"