PDA

View Full Version : Add value in empty cell always same line column after column



cabete
06-04-2012, 03:08 AM
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.



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


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

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

Bob Phillips
06-04-2012, 08:19 AM
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

cabete
06-05-2012, 12:57 AM
No i am specking change the row to columns.
I found the error already.

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

But now if i want to star in a specific column??? How to do that?