PDA

View Full Version : MyPosition Userform Help VBA - Excel2000



jimbokentuck
09-06-2008, 02:55 PM
Hi,
Need some help with a Userform in VBA/Excel. Have written a series or macros that open the userform for input. What I'd like to happen is whenever the user triggers the macro to open the userform, I'd like the data to be input into the cell to the right of the users current position in the worksheet. However the code I'm using to input the data into the worksheet is continually placing the answer in the same cell and doesn't change. Somehow I'd like to write a code that will place the information into the worksheet, current position +1.

Thanks,
Jimbo


Dim ctl As Control
RowCount = Worksheets("Expense Report").Range("A1").CurrentRegion.Rows.Count
With Worksheets("Expense Report").Range("A10")
.Offset(RowCount, 30).Value = Me.GSTEXPENSE.Value
End With

mdmackillop
09-06-2008, 03:50 PM
This should work on the active sheet

Selection.Offset(, 1).Value = Me.GSTEXPENSE.Value

jimbokentuck
09-06-2008, 04:16 PM
Thanks for your help! Works perfectly...

jimbokentuck
09-06-2008, 05:07 PM
:banghead: Oops, just doing some further testing and realized that since there are 2 cells that can trigger the macro to run the userform that I may just need to specify my current row position and fix the column. Say I'm on row 45 then I'd like for the data from the userform to always end up in column W.

Dim ctl As Control
Selection.Offset(, 1).Value = Me.GSTEXPENSE.Value
Exit Sub

mikerickson
09-06-2008, 05:10 PM
ActiveCell.EntireRow.Range("W1").Value = Me.GSTEXPENSE.Value