Forum Discussion
SamFares
Aug 30, 2021Brass Contributor
Bootstrap
Hello, I don't know why if I type in any cell in an excel sheet that has bootstrap statistics analysis, it resamples again. Please see attached sheet. Thanks, Sam
- Aug 31, 2021
Try this:
Sub Resample() Dim NumSamples As Long Dim LastRow As Long NumSamples = Val(InputBox("How many samples do you need (31 - 500)?")) If NumSamples < 31 Or NumSamples > 500 Then MsgBox "Invalid input. Must be between 31 and 500!", vbExclamation Exit Sub End If Application.ScreenUpdating = False LastRow = Range("A" & Rows.Count).End(xlUp).Row Range("AG26:SH" & LastRow).ClearContents With Range(Cells(26, 33), Cells(LastRow, NumSamples + 2)) .FormulaR1C1 = "=INDEX(RC3:RC32,RANDBETWEEN(1,30))" .Value = .Value End With Application.ScreenUpdating = True End Sub
HansVogelaar
Aug 31, 2021MVP
Try this:
Sub Resample()
Dim NumSamples As Long
Dim LastRow As Long
NumSamples = Val(InputBox("How many samples do you need (31 - 500)?"))
If NumSamples < 31 Or NumSamples > 500 Then
MsgBox "Invalid input. Must be between 31 and 500!", vbExclamation
Exit Sub
End If
Application.ScreenUpdating = False
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("AG26:SH" & LastRow).ClearContents
With Range(Cells(26, 33), Cells(LastRow, NumSamples + 2))
.FormulaR1C1 = "=INDEX(RC3:RC32,RANDBETWEEN(1,30))"
.Value = .Value
End With
Application.ScreenUpdating = True
End SubSamFares
Aug 31, 2021Brass Contributor
I appreciated it a lot. Thank you so MUCH Hans!
Sam
Sam