Consulting

Results 1 to 3 of 3

Thread: Add value in empty cell always same line column after column

  1. #1
    VBAX Regular
    Joined
    Jun 2012
    Posts
    6
    Location

    Add value in empty cell always same line column after column

    Hello everyone, i have this code in a work but after work the data like there is its difficulty so i decide change. Instead past i the same column line after line i would like to past always in the same line but column after column, but i am unsuccessful at the moment.



    [VBA]Private Sub OKButton_Click()
    Dim emptyRow As Long
    Sheets(1).Activate
    emptyRow = WorksheetFunction.CountA(Range("Q:Q")) + 1
    Cells(emptyRow, 17).Value = INDUÇÃOTextBox.Value
    Unload Me
    End Sub[/VBA]


    i try change but save me the values always in the same cell.

    [VBA]Private Sub OKButton_Click()
    Dim emptyRow As Long
    Sheets(1).Activate
    emptyColumn = WorksheetFunction.Count(Range("B2")) + 1
    Cells(2, emptyColumn).Value = INDUÇÃOTextBox.Value
    Unload Me
    End Sub[/VBA]
    Last edited by Bob Phillips; 06-04-2012 at 08:18 AM. Reason: Added VBA tags

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [VBA]Private Sub OKButton_Click()
    Dim emptyRow As Long
    Sheets(1).Activate
    emptyColumn = WorksheetFunction.Count(Rows(2)) + 1
    Cells(2, emptyColumn).Value = INDUÇÃOTextBox.Value
    Unload Me
    End Sub [/VBA]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Jun 2012
    Posts
    6
    Location
    No i am specking change the row to columns.
    I found the error already.

    [VBA]Private Sub OKButton_Click()
    Dim emptyRow As Long
    Sheets(1).Activate
    emptyColumn = Cells(2, Columns.Count).End(xlToLeft).Column + 1
    Cells(2, emptyColumn).Value = INDUÇÃOTextBox.Value
    Unload Me
    End Sub
    [/VBA]
    But now if i want to star in a specific column??? How to do that?
    Last edited by Bob Phillips; 06-05-2012 at 01:04 AM. Reason: Added VBA tags

Posting Permissions

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