+ Reply to Thread
Results 1 to 4 of 4

And values same row column after column

Hybrid View

  1. #1
    Registered User
    Join Date
    05-30-2012
    Location
    Lisbon
    MS-Off Ver
    Excel 2003
    Posts
    37

    And values same row 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.

    OLD CODE
    
    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.

    NEW CODE TRYING
    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

    The excel with the sample its to big almost 2mb and the forum dont allow
    Last edited by nunocabete; 06-04-2012 at 06:34 AM. Reason: Please use code tags in future.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: And values same row column after column

    Your question is not very clear. Why dont you attach a sample excel file so we can understand better?

    To Attach a File:

    1. Click on Go Advanced.
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: And values same row column after column

    How about?

    Private Sub OKButton_Click()
        Dim emptyRow As Long
        Sheets(1).Activate
        emptyRow = Cells(Rows.Count, "Q").End(xlUp).Row + 1
        Cells(emptyRow, "Q").Value = INDUÇÃOTextBox.Value
        Unload Me
    End Sub
    
    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

  4. #4
    Registered User
    Join Date
    05-30-2012
    Location
    Lisbon
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: And values same row column after column

    Perfect, already try lots of think and its so simple.

    But now i don t know how to do one thing

    If i want to star in a specif cell in that line how to do that???
    Last edited by nunocabete; 06-04-2012 at 09:27 AM.

+ 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