Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Range with computed column number

Range(A5000) is a valid VBA expression.

How do I specify "A" as a variable?

Range(Columns(n)5000) or something like that?

Where n is an integer column number obtained separately.

The above trial expression returns an error message:

Expected separator or ")" .

But the trial expression has balanced parenthses.

Thanks,

Fred Holmes
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Range with computed column number

hi
not sure exactly what you are after but is this close????
Sub FredHolmes()
Dim c As String
c = InputBox("enter column letter")
'or
'c = "A"
Range(c & "10").Select
End Sub

hope i guessed good
regards
FSt1


"Fred Holmes" wrote:

Range(A5000) is a valid VBA expression.

How do I specify "A" as a variable?

Range(Columns(n)5000) or something like that?

Where n is an integer column number obtained separately.

The above trial expression returns an error message:

Expected separator or ")" .

But the trial expression has balanced parenthses.

Thanks,

Fred Holmes

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Range with computed column number

No, unforturnately. The column designator has to be a number, because
it is computed from other variables using math.

Fred Holmes

On Wed, 21 Jan 2009 21:42:01 -0800, FSt1
wrote:

hi
not sure exactly what you are after but is this close????
Sub FredHolmes()
Dim c As String
c = InputBox("enter column letter")
'or
'c = "A"
Range(c & "10").Select
End Sub

hope i guessed good
regards
FSt1


"Fred Holmes" wrote:

Range(A5000) is a valid VBA expression.

How do I specify "A" as a variable?

Range(Columns(n)5000) or something like that?

Where n is an integer column number obtained separately.

The above trial expression returns an error message:

Expected separator or ")" .

But the trial expression has balanced parenthses.

Thanks,

Fred Holmes


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Range with computed column number

hi
afterthought.
vb's error messages are not fool proof. vb is real picky about syntax and at
times will throw up odd error messages based on what it runs into. the
general catch all error in 1004 application or object defined error. meaning
something's wrong but i don't know what. i think your's is a syntax problem
where vb doesn't recognize the word column as you have it written. i'm
guessing.

Regards
FSt1

"Fred Holmes" wrote:

Range(A5000) is a valid VBA expression.

How do I specify "A" as a variable?

Range(Columns(n)5000) or something like that?

Where n is an integer column number obtained separately.

The above trial expression returns an error message:

Expected separator or ")" .

But the trial expression has balanced parenthses.

Thanks,

Fred Holmes

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Range with computed column number

How do I specify "A" as a variable?

Range(Columns(n)5000) or something like that?

Where n is an integer column number obtained separately.


Range(Cells(5000,n))

You may need to fully-reference Rang and/or Cells.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Range with computed column number

Many thanks. Great lead!

Actually,

Cells(5000, n)

is the expression I'm looking for.

Fred Holmes

On Thu, 22 Jan 2009 08:17:12 -0000, "IanKR"
wrote:

How do I specify "A" as a variable?

Range(Columns(n)5000) or something like that?

Where n is an integer column number obtained separately.


Range(Cells(5000,n))

You may need to fully-reference Rang and/or Cells.


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
printing to a computed column Dean[_8_] Excel Programming 2 September 23rd 07 01:51 AM
Select a range by column number David Andrews Excel Programming 2 June 9th 07 03:06 PM
cell column number for the max value of a range of numbers Aline Excel Discussion (Misc queries) 1 February 22nd 07 08:36 AM
How delete formula bar and retain the computed number in a cell? Les P. Excel Worksheet Functions 3 May 13th 06 08:50 PM
How do I sort a column of computed variables in EXCEL? Sylgeox Excel Worksheet Functions 2 October 3rd 05 12:07 AM


All times are GMT +1. The time now is 02:16 PM.

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

About Us

"It's about Microsoft Excel"