Populating spreadsheet with userform input

WelshBanana

New Member
Joined
Jun 28, 2011
Messages
2
I created a userform with a student number txt box and 5 pairs of txt boxes. The form has an enter cmd button and a clear cmd button.
Target Data
StuNum (txtstunum)
Shot X coordinate Y coordinate
1 (txtshot1) (txtshot2)
2 (txtshot3) (txtshot4)
3 (txtshot5) (txtshot6)
4 (txtshot7) (txtshot8)
5 (txtshot9) (txtshot10)

I am trying to move the user inputted information into a spreadsheet vertically starting at the next open row and looping through each entry when the user clicks the enter cmd button. When the user clicks the clear cmd button I would like to move down 3 rows to start again with the next series of entries. Once all entries for that shotting distance have been entered I would like to return to the top and input the next distance entries without overwriting the first series.

Am I making sense?

Scenario: 10 Soldiers shoot 5-round shot groups from 500 yards. Targets are pulled, x y coordinates are determined and entered into userform for each Soldier. Same Soldiers move to 400 yard line and shoot next series of 5-round groups, targets are pulled and x y cordinates are determined and entered into userform, and so on down to 200 yards.

Spreadsheet looks like this

500yards 400yards
StuNum X Y X Y
X Y X Y
X Y X Y
X Y X Y
X Y X Y


StuNum X Y X Y
ETC.

Any help is greatly appreciated.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
I have been experimenting and have been able to generate a subroutine that places my dat in the right cells. However, I am still working on how to transistion to the next group, it might take another command buttons on the userform for each group, i.e. 400yard button.

This is what I have so far:

Private Sub cmdOK_Click()
ActiveWorkbook.Activate
Range("A1").Select

Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Activate
End If
Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = txtStudentNum.Value
ActiveCell.Offset(2, 0) = txtLaneNum.Value

Do

If IsEmpty(ActiveCell) = False Then

ActiveCell.Offset(0, 1).Activate

End If

Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = txtShot1.Value
ActiveCell.Offset(0, 1) = txtShot2.Value
ActiveCell.Offset(1, 0) = txtShot3.Value
ActiveCell.Offset(1, 1) = txtShot4.Value
ActiveCell.Offset(2, 0) = txtShot5.Value
ActiveCell.Offset(2, 1) = txtShot6.Value
ActiveCell.Offset(3, 0) = txtShot7.Value
ActiveCell.Offset(3, 1) = txtShot8.Value
ActiveCell.Offset(4, 0) = txtShot9.Value
ActiveCell.Offset(4, 1) = txtShot10.Value


If IsEmpty(ActiveCell) = False Then

ActiveCell.Offset(7, -1).Activate

End If


End Sub


I have also installed a Mean Radius button that should return the value of an excel formula, however, I am having a time getting it to work. This is what I have

Private sub cmdMeanRadius_click()

MsgBox "The Mean Radius is ", activecell.offset(6,0).value

end sub
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,626
Members
452,933
Latest member
patv

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