LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Counting Variable Length of Rows in a Named Range


I need help.

I have gotten to where I am in my excel programming by perusing th
help file. I have a command button that i want to combine the value o
itself with the value of another cell. Basically i want:

If H10L10 then --- Row 10 is where my data starts, not Row 1
L10 = L10 + N10
end if

I have this in a For Next loop. I also defined a name of the rang
(H10, defined name is "Work_Total_Exp" and range = " ='Detai
Sheet'!$H$11:$H$236 ") and want the For Next loop to count the numbe
of rows (variable) and run the above IF THEN statement thru the tota
number of rows in Work_Total_Exp. I hope this makes sense...

the problem i'm coming into is the Work_Total_Exp range right now ha
225 rows, yet my code returns the value of 14. basically its countin
from Row 1 down to Row 14. i cant figure out why its starting at Row
and stopping at Row 14


Code
-------------------
Sub Button1_Click() 'Updates Work Complete from Previous Application

Set Work_Total_Exp = ActiveWorkbook.Names
Set wks = Worksheets("Detail Sheet")
Dim row, totalrows As Integer
Dim colExpTotal, colRenTotal, colExpWorkPrev, colRenWorkPrev, colExpWorkCur, colRenWorkCur As Integer
Dim colExpPercentPrev, colRenPercentPrev, colExpPercentCur, colRenPercentCur As Integer
totalrows = Work_Total_Exp.Count
colExpTotal = 8 'column H - hidden
colExpPercentPrev = 9 'column I - hidden
colExpWorkPrev = 12 'column L
colExpWorkCur = 14 'column N
colExpPercentCur = 20 'column T
'BELOW ADDS THE EXPANSION WORK COMPLETED FROM PREVIOUS APPLICATION
For row = 1 To totalrows
If wks.Cells(row, colExpTotal).Value wks.Cells(row, colExpWorkPrev).Value Then
wks.Cells(row, colExpWorkPrev) = wks.Cells(row, colExpWorkPrev) + wks.Cells(row, colExpWorkCur)
wks.Cells(row, colExpPercentPrev).Value = wks.Cells(row, colExpPercentCur)
End If
Next
End Su
-------------------


please help :(

thanks!

-Jami

--
jandr
-----------------------------------------------------------------------
jandre's Profile: http://www.excelforum.com/member.php...fo&userid=1583
View this thread: http://www.excelforum.com/showthread.php?threadid=27323

 
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
Variable series length/range JessK Charts and Charting in Excel 1 March 3rd 06 04:02 AM
Using a Macro to Sum a Variable-Length Range (a Column) Chuckles123[_15_] Excel Programming 0 October 5th 04 06:46 AM
Using a Macro to Sum a Variable-Length Range (a Column) Chuckles123[_9_] Excel Programming 2 October 5th 04 12:34 AM
Using a Macro to Sum a Variable-Length Range (a Column) Chuckles123[_2_] Excel Programming 1 October 3rd 04 11:51 PM
Using a Macro to Sum a Variable-Length Range (a Column) Chuckles123 Excel Programming 2 October 3rd 04 01:12 PM


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