Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Change it to a variable

HI
i have this code:
Range("perioder!$H$" & start).Value
where start is a variable
now i also want to change $h$ to a variable
but i Can't make it right
Help
Alvin

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Change it to a variable

Where c col is a number 1..256.

Sheets("perioder").cells(start,Col).Value


"alvin Kuiper" wrote:

HI
i have this code:
Range("perioder!$H$" & start).Value
where start is a variable
now i also want to change $h$ to a variable
but i Can't make it right
Help
Alvin

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Change it to a variable

Try using the cells command instead, it is much easier to call both a row and
column. The column does have to be a number reference.

Sheets("perioder").Cells (start,column number).value
--
If this helps, please remember to click yes.


"alvin Kuiper" wrote:

HI
i have this code:
Range("perioder!$H$" & start).Value
where start is a variable
now i also want to change $h$ to a variable
but i Can't make it right
Help
Alvin

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Change it to a variable

Try this

Dim MyCell As String
Dim Start As Long
MyCell = "H"
Start = 1
x = Range("perioder!" & MyCell & Start).Value

Mike

"alvin Kuiper" wrote:

HI
i have this code:
Range("perioder!$H$" & start).Value
where start is a variable
now i also want to change $h$ to a variable
but i Can't make it right
Help
Alvin

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,480
Default Change it to a variable

Hi Alvin

One way, with colno as the variable holding the column number required (8),
then
sheets("perioder").cells(start , colno).Value

--
Regards
Roger Govier

"alvin Kuiper" wrote in message
...
HI
i have this code:
Range("perioder!$H$" & start).Value
where start is a variable
now i also want to change $h$ to a variable
but i Can't make it right
Help
Alvin



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Change it to a variable

Sheets("perioder").Cells(start,8).value

OR

strCol = "H"
Range("perioder!" & strCol & start).Value

OR

strCol = "H"

Sheets("perioder").cells(start,strCol).Value

--
If this post helps click Yes
---------------
Jacob Skaria


"alvin Kuiper" wrote:

HI
i have this code:
Range("perioder!$H$" & start).Value
where start is a variable
now i also want to change $h$ to a variable
but i Can't make it right
Help
Alvin

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Change it to a variable

Thanks to all

And Jacob I give a beer if you ever come to denmark
Just write
Alvin


"Jacob Skaria" skrev:

Sheets("perioder").Cells(start,8).value

OR

strCol = "H"
Range("perioder!" & strCol & start).Value

OR

strCol = "H"

Sheets("perioder").cells(start,strCol).Value

--
If this post helps click Yes
---------------
Jacob Skaria


"alvin Kuiper" wrote:

HI
i have this code:
Range("perioder!$H$" & start).Value
where start is a variable
now i also want to change $h$ to a variable
but i Can't make it right
Help
Alvin

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Change it to a variable

Thanks Alvin for the feedback and offer..

If this post helps click Yes
---------------
Jacob Skaria


"alvin Kuiper" wrote:

Thanks to all

And Jacob I give a beer if you ever come to denmark
Just write
Alvin


"Jacob Skaria" skrev:

Sheets("perioder").Cells(start,8).value

OR

strCol = "H"
Range("perioder!" & strCol & start).Value

OR

strCol = "H"

Sheets("perioder").cells(start,strCol).Value

--
If this post helps click Yes
---------------
Jacob Skaria


"alvin Kuiper" wrote:

HI
i have this code:
Range("perioder!$H$" & start).Value
where start is a variable
now i also want to change $h$ to a variable
but i Can't make it right
Help
Alvin

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
Const or Variable that doesn't change Risky Dave Excel Programming 5 December 13th 09 01:23 AM
Change a Variable Name in a For...Loop RyanH Excel Programming 0 May 14th 08 02:22 PM
Change variable value of -1 to 1 Les Stout[_2_] Excel Programming 5 July 11th 07 02:28 PM
change firstrow variable to be the 2nd row value instead of the fi Janis Excel Programming 1 September 11th 06 07:23 PM
Change variable permanently Arne Hegefors Excel Programming 4 August 28th 06 01:10 PM


All times are GMT +1. The time now is 06:38 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"