Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lee Lee is offline
external usenet poster
 
Posts: 33
Default Referencing variable

I want to run the followingcode in specific columns, but
in several different rows. The columns will always stay
the same, but the number of rows will be different each
time I run the code.

If Range("h2") = "Procedural" Then
Range("j2").Formula = "Procedural"
Exit Sub
ElseIf Range("f2") 0 Then
Range("j2").Formula = "Overpayment"
ElseIf Range("g2") 0 Then
Range("j2").Formula = "Underpayment"
End If

I'm using a count procedure to count number of rows in the
usedrange, and figured I'd use a loop statement, but I
can't see how to reference the rows as variables.

Thanks,
Lee
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Referencing variable

for i = 2 to 100
If Cells(i,8) = "Procedural" then
Cells(i,10).Formula = "Procedural"
exit Sub
Elseif

and so forth.

Replace 100 with a variable that contains your count.

--
Regards,
Tom Ogilvy


"Lee" wrote in message
...
I want to run the followingcode in specific columns, but
in several different rows. The columns will always stay
the same, but the number of rows will be different each
time I run the code.

If Range("h2") = "Procedural" Then
Range("j2").Formula = "Procedural"
Exit Sub
ElseIf Range("f2") 0 Then
Range("j2").Formula = "Overpayment"
ElseIf Range("g2") 0 Then
Range("j2").Formula = "Underpayment"
End If

I'm using a count procedure to count number of rows in the
usedrange, and figured I'd use a loop statement, but I
can't see how to reference the rows as variables.

Thanks,
Lee



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
Referencing another workbook using a variable for the sheet? Doug Excel Worksheet Functions 21 May 28th 10 06:45 PM
Variable cell referencing Paul Excel Worksheet Functions 1 February 16th 08 10:55 PM
Referencing tab based on Variable Chad Excel Worksheet Functions 2 June 8th 07 03:48 PM
Variable Cell Referencing 0-0 Wai Wai ^-^ Excel Worksheet Functions 3 June 16th 06 09:34 AM
Referencing Variable Name Worksheets camerons New Users to Excel 8 May 9th 05 09:57 PM


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