+ Reply to Thread
Results 1 to 3 of 3

Using Button on User Form to save Data to specific Cell??

Hybrid View

  1. #1
    DarnTootn
    Guest

    Using Button on User Form to save Data to specific Cell??

    I can make my button work this way...
    Private Sub cmdAdd_Click()
    Dim iRow As Long
    Dim ws As Worksheet
    Set ws = Worksheets("Billing Sheet")

    'find first empty row in database
    iRow = ws.Cells(Rows.Count, 1) _
    .End(xlUp).Offset(1, 0).Row

    'copy data to database
    With ws
    .Cells(iRow, 1).Value = Me.txtCoopName.Value
    End With

    'clear the data
    Me.txtCoopName.Value = ""
    Me.txtCoopName.SetFocus
    End Sub

    But I need the Data to go to a specific Cell rather than the first open row
    exel finds on the specified sheet.. If I take out...
    'find first empty row in database
    iRow = ws.Cells(Rows.Count, 1) _
    .End(xlUp).Offset(1, 0).Row
    then it gives me an error
    PLEASE HELP!!!!!!!

  2. #2
    Harald Staff
    Guest

    Re: Using Button on User Form to save Data to specific Cell??


    ..Cells(3, 2).Value = Me.txtCoopName.Value

    will write to row 3 column 2, aka B3.

    HTH. Best wishes Harald

    "DarnTootn" <DarnTootn@discussions.microsoft.com> skrev i melding
    news:9643BE61-B118-4B1F-9822-96934BDFFB95@microsoft.com...
    > I can make my button work this way...
    > Private Sub cmdAdd_Click()
    > Dim iRow As Long
    > Dim ws As Worksheet
    > Set ws = Worksheets("Billing Sheet")
    >
    > 'find first empty row in database
    > iRow = ws.Cells(Rows.Count, 1) _
    > .End(xlUp).Offset(1, 0).Row
    >
    > 'copy data to database
    > With ws
    > .Cells(iRow, 1).Value = Me.txtCoopName.Value
    > End With
    >
    > 'clear the data
    > Me.txtCoopName.Value = ""
    > Me.txtCoopName.SetFocus
    > End Sub
    >
    > But I need the Data to go to a specific Cell rather than the first open

    row
    > exel finds on the specified sheet.. If I take out...
    > 'find first empty row in database
    > iRow = ws.Cells(Rows.Count, 1) _
    > .End(xlUp).Offset(1, 0).Row
    > then it gives me an error
    > PLEASE HELP!!!!!!!




  3. #3
    DarnTootn
    Guest

    Re: Using Button on User Form to save Data to specific Cell??

    Thank you ... that does the trick...my best to you


    "Harald Staff" wrote:

    >
    > ..Cells(3, 2).Value = Me.txtCoopName.Value
    >
    > will write to row 3 column 2, aka B3.
    >
    > HTH. Best wishes Harald
    >
    > "DarnTootn" <DarnTootn@discussions.microsoft.com> skrev i melding
    > news:9643BE61-B118-4B1F-9822-96934BDFFB95@microsoft.com...
    > > I can make my button work this way...
    > > Private Sub cmdAdd_Click()
    > > Dim iRow As Long
    > > Dim ws As Worksheet
    > > Set ws = Worksheets("Billing Sheet")
    > >
    > > 'find first empty row in database
    > > iRow = ws.Cells(Rows.Count, 1) _
    > > .End(xlUp).Offset(1, 0).Row
    > >
    > > 'copy data to database
    > > With ws
    > > .Cells(iRow, 1).Value = Me.txtCoopName.Value
    > > End With
    > >
    > > 'clear the data
    > > Me.txtCoopName.Value = ""
    > > Me.txtCoopName.SetFocus
    > > End Sub
    > >
    > > But I need the Data to go to a specific Cell rather than the first open

    > row
    > > exel finds on the specified sheet.. If I take out...
    > > 'find first empty row in database
    > > iRow = ws.Cells(Rows.Count, 1) _
    > > .End(xlUp).Offset(1, 0).Row
    > > then it gives me an error
    > > PLEASE HELP!!!!!!!

    >
    >
    >


+ Reply to Thread

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