Results 1 to 3 of 3

Send Userform data to selected row

Threaded View

  1. #1
    Registered User
    Join Date
    11-16-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    34

    Send Userform data to selected row

    Hi There,

    Attached is a spreadsheet with a very basic userform. The userform is loaded when a cell in column A is selected. Currently, the data from the userform is sent to the first blank row; however I was wondering whether it was possible to send the data to the selected row. So for example if I selected "A9", the data from the userform would be sent to "B9, C9, D9" etc....

    Here is the code I'm using:

    Private Sub CommandButton1_Click()
    
        Dim iRow As Long
        Dim Rng As Range
        Dim ws As Worksheet
    
            Set ws = Worksheets("DataSource")
            Set Rng = ws.Range("A2")
    
                iRow = ws.Cells(Rows.Count, Rng.Column).End(xlUp).Row
                iRow = IIf(iRow < Rng.Row, Rng.Row, iRow + 1)
    
                ws.Cells(iRow, 1) = example1.Value
                ws.Cells(iRow, 2) = example2.Value
                ws.Cells(iRow, 3) = date1.Value
                ws.Cells(iRow, 4) = comboexample.Value
                ws.Cells(iRow, 5) = date1.Value
                ws.Cells(iRow, 6) = comboexample2.Value
                ws.Cells(iRow, 7) = example5.Value
                ws.Cells(iRow, 13) = comboexample3.Value
                ws.Cells(iRow, 16) = comboexample4.Value
                ws.Cells(iRow, 16) = comboexample5.Value
    
            Unload Me
    
    End Sub
    Thanks for the help.
    Attached Files Attached Files
    Last edited by revenge4ash89; 01-10-2012 at 05:10 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1