markusreyes2907
New Member
- Joined
- Jul 14, 2020
- Messages
- 34
- Office Version
- 2013
- Platform
- Windows
Hi, I'm quite new to VBA and am trying to essentially build code that will generate a table via output from input boxes. I am doing fine except I can't figure how to set up the "y" axis of my table. Right now I have three input boxes, the first to enter the number of reps, the second the number of treatment groups, and the third the number of days for the study. input box one and two should impact the range "A6" to A... depending on the input. Essentially I want treatment groups (ex. 1, 2, 3, 4, and 5) to be spaced apart in The A column in reference to the number of reps, with an extra empty cell in between. So, if the user inputs 3 reps and 3 treatment groups "A6" should say 1, "A10" should say 2, and so "A14" should say 3. Below is some code I have, I've been getting close, but can't figure out the exact execution.
Thanks,
markusreyes2907
VBA Code:
Dim reps As Integer, i As Integer, trtmnt As Integer, j As Integer, spce As Integer
reps = InputBox("Number of reps", "Enter Here")
trtmnt = InputBox("Number of treatment groups", "Enter Here")
spce = reps + 1
For i = 1 To reps
Range("A6").Cells(j, 1).Offset(spce, 0).Value = j
For j = 1 To trtmnt
Next j
Next i
Thanks,
markusreyes2907
Last edited by a moderator: