Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default if and else question

when using and if and else routine, can more than 1 variable be set.

for example.

if x =1 then
ShtNm = "sheet1"
mName = "Jan"
elseif x =2 then
ShtNm = "Sheet2"
mName = "Feb"
endif

i think you get the idea. if so, how would i do it?

thanks
--


Gary



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default if and else question

what i would like to do, is set the 2nd variable to a range so i could use
the offset function in a loop.
so, in the formula, it would use the range set by the variable the 1st time
through, then using the offset it would use that range in the formula. the
range is a single cell.

sorry for the additional post

--


Gary


"Gary Keramidas" wrote in message
...
when using and if and else routine, can more than 1 variable be set.

for example.

if x =1 then
ShtNm = "sheet1"
mName = "Jan"
elseif x =2 then
ShtNm = "Sheet2"
mName = "Feb"
endif

i think you get the idea. if so, how would i do it?

thanks
--


Gary





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default if and else question

Your code is fine. To set a range declare a range object and set, e.g.

Dim rng As Range

Set rng = Worksheets(ShtNm).Range("A1")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Gary Keramidas" wrote in message
...
what i would like to do, is set the 2nd variable to a range so i could use
the offset function in a loop.
so, in the formula, it would use the range set by the variable the 1st

time
through, then using the offset it would use that range in the formula. the
range is a single cell.

sorry for the additional post

--


Gary


"Gary Keramidas" wrote in message
...
when using and if and else routine, can more than 1 variable be set.

for example.

if x =1 then
ShtNm = "sheet1"
mName = "Jan"
elseif x =2 then
ShtNm = "Sheet2"
mName = "Feb"
endif

i think you get the idea. if so, how would i do it?

thanks
--


Gary







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default if and else question

ok, thanks bob

--


Gary


"Bob Phillips" wrote in message
...
Your code is fine. To set a range declare a range object and set, e.g.

Dim rng As Range

Set rng = Worksheets(ShtNm).Range("A1")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Gary Keramidas" wrote in message
...
what i would like to do, is set the 2nd variable to a range so i could
use
the offset function in a loop.
so, in the formula, it would use the range set by the variable the 1st

time
through, then using the offset it would use that range in the formula.
the
range is a single cell.

sorry for the additional post

--


Gary


"Gary Keramidas" wrote in message
...
when using and if and else routine, can more than 1 variable be set.

for example.

if x =1 then
ShtNm = "sheet1"
mName = "Jan"
elseif x =2 then
ShtNm = "Sheet2"
mName = "Feb"
endif

i think you get the idea. if so, how would i do it?

thanks
--


Gary









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
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good davegb Excel Programming 1 May 6th 05 06:35 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 27th 05 07:46 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 23 April 23rd 05 09:26 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 22nd 05 03:30 PM


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