ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   please help simplify (https://www.excelbanter.com/excel-programming/311582-please-help-simplify.html)

acarril[_11_]

please help simplify
 

thank you so much. I have one question: i have almost 5000 rows to ru
through-is there a way to have it loop through based on the conditio
"lease type"? you've been so helpful i hate to even ask but this i
way over my head

--
acarri
-----------------------------------------------------------------------
acarril's Profile: http://www.excelforum.com/member.php...fo&userid=1002
View this thread: http://www.excelforum.com/showthread.php?threadid=26204


Tom Ogilvy

please help simplify
 
Assume lease type is in Column E and the values start in row2

set rng = Range(cells(2,"E"),Cells(rows.count,"E").End(xlup) )
for each cell in rng
Select Case lcase(cell.Value)
Case "temporary"
' process a temporary lease
Case "permanent"
' process row as a permanent lease
Case "contingent"
' process row as a contingent less
CaseElse
cell.Select
msgbox "Lease type " & cell.Value & " is unknown"
End Select
Next

Assumes there are three types of leases "Temporary", "Permanent",
"Conditional" just for illustrative purposes, and that these are the string
values that would be found in column E.

--
Regards,
Tom Ogilvy



"acarril" wrote in message
...

thank you so much. I have one question: i have almost 5000 rows to run
through-is there a way to have it loop through based on the condition
"lease type"? you've been so helpful i hate to even ask but this is
way over my head.


--
acarril
------------------------------------------------------------------------
acarril's Profile:

http://www.excelforum.com/member.php...o&userid=10027
View this thread: http://www.excelforum.com/showthread...hreadid=262049





All times are GMT +1. The time now is 08:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com