macro's programming any modification

starsunny148

New Member
Joined
May 4, 2016
Messages
3
Hi guys this is very urgent!,when i'm using below code macro's for creating looping till line no.7 everything is OK but the main problem is line no.8 . my actual problem is after completion of first loop it is showing maximum value in column 5 and row 1 but after second loop is over another maximum value got in column 5 and row 2 in excel but at the same time the value whatever is there in column 5 and row 1 is also changing so i do not want changing of first value after second loop and so on...... please help me in this very urgent

Code:
Sub MACRO1 ()


For pp = 1 To 5


Cells(1,1).Formula = pp


Cells(2, 1).Formula = pp / 10


Cells(3, 1).Formula = pp + 10


Cells(4, 1).Formula = pp * 10


Cells(5, 1).Formula = pp * 5 + 2


Cells(pp, 5).Value = "=Max(A1:A5)"


Next pp


End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Replace that line with:

Code:
With Cells(pp, 5)
    .Formula = "=Max(A1:A5)"
    .Value = .Value
End With
 
Upvote 0
The answer will always be equal to pp*10 for any value of pp greater than 1 by the way.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top