Help with inserting increasing number in a column

kbriaz

Board Regular
Joined
Dec 5, 2013
Messages
91
Hi,

I need help with below macro. I want to change it so it only inserts number '1' into first 16 rows. next 16 rows i want it to insert number '2' & number '3' for the next 16 rows & so on only where value in Range(D7:D200) is 'uphold' or 'reject'. I want it to continue until there is a value in Range (B7:B200)


Sub Add_box_numbers()


Range("P7:P200").Select
For Each cell In Selection
If cell.Value = "" Then
Else
cell.Value = cell.Value + 1
End If
Next cell


End Sub

Is it possible ? Many thanks for your help in advance.

P.s Basically these are box numbers i am trying to add. ( 16 in one box )
 
B170 will contain text & numbers combines I.e Test01 or Test00000010

D170 will only contain text i.e Referral

Or, it could count where in column 'D' it says 'Rejection' & across 12 cells i.e Column 'P' it looks for Max number.

Then adds +1 to Max number found, which will be the first number for 'Referrals'

I.e Rejections ended up in box 5, then Referrals will end up in box after which is 6.

Sorry to complicate things even further :(
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Does B170 and D170 CURRENTLY contain values? If not, then my formula will give a blank result. If they do, and D170 = "Referral", then my formula should work. If that is not the case then you will have to send me the workbook so I can examine it.
 
Upvote 0
Does B170 and D170 CURRENTLY contain values? If not, then my formula will give a blank result. If they do, and D170 = "Referral", then my formula should work. If that is not the case then you will have to send me the workbook so I can examine it.

Yes they do.

Result i get is 0 for below

=IF(AND(LOWER(D170)="Referral",B170<>""),INT((ROW(A1)-1)/16)+1+MAX(P7:P156),"")

I will attach spreadsheet soon - ta
 
Upvote 0

Forum statistics

Threads
1,214,545
Messages
6,120,128
Members
448,947
Latest member
test111

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