Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hello there
I have the following code (which works properly) but by the time I extend it out to run 120 times with 40 IF statements in each it will be MASSIVE! What I would like to do is use a DO Loops instead, if you could please advise. I have only included a sample of the code for brevity in this question. The code is as follows: Sub Allocate_loans_to_properties() ASSET_1_LOAN_1: Range("AS32").ClearContents If Range("G32") = "1" Then Range("F32").Copy Range("AS32").PasteSpecial Paste:=xlPasteValues GoTo ASSET_1_LOAN_2 ElseIf Range("G33") = "1" Then Range("F33").Copy Range("AS32").PasteSpecial Paste:=xlPasteValues GoTo ASSET_1_LOAN_2 ' and so on up to cell G72 End If ASSET_1_LOAN_2: Range("AT32").ClearContents If Not Range("AS32") = Range("F32") And Range("G32") = "1" Then Range("F32").Copy Range("AT32").PasteSpecial Paste:=xlPasteValues GoTo ASSET_1_LOAN_3 ElseIf Not Range("AS32") = Range("F33") And Range("G33") = "1" Then Range("F33").Copy Range("AT32").PasteSpecial Paste:=xlPasteValues GoTo ASSET_1_LOAN_3 ' and so on up to cell G72 End If ' then it repeats this 4 more times to allocate up to six loans to ASSET 1 ' then it repeats all of that for the next 19 assets!! Thankyou for your time and help Regards, Brett |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How would I add a loop for this? | Excel Discussion (Misc queries) | |||
loop | Excel Discussion (Misc queries) | |||
help with a loop | Excel Discussion (Misc queries) | |||
Help with Do...Loop | Excel Discussion (Misc queries) | |||
Which loop to use | Excel Discussion (Misc queries) |