Hi I'm trying to add string = "bid canceled" in a column in range 2 to 6 time for each same Auction-ID if the bid status is empty:
Private Sub Bidcanceled_Click()
Application.ScreenUpdating = False
Dim Bidstatus As Range, rng As Range, rng1 As Range, x As Integer, N As Long
Dim str As String
N = Cells(Rows.Count, "A").End(xlUp).Row
Set rng = Range("H2:H" & N)
str = "bid canceled"
For Each Bidstatus In rng
Select Case Int(Rnd * 10) Mod 2
Case 1: lb = 2: ub = 6
End Select
x =
' Do While Application.WorksheetFunction.CountIf(rng, x) >= 1
Do While Application.WorksheetFunction.CountIfs(rng.Offset(, -1), Bidstatus.Offset(, -1), rng, x) >= 1
x =
Loop
Bidstatus = x
Next
Application.ScreenUpdating = True
End Sub
the attachment in sheet one is the output that I except, I didnt know how to insert string 2 times or 3 or 4 ...6 times in random cells for each auction id if the cells are empty,any idea for that?
Bookmarks