+ Reply to Thread
Results 1 to 4 of 4

How to copy value from textbox to cell, and auto select cell below?

Hybrid View

  1. #1
    Registered User
    Join Date
    11-12-2015
    Location
    Surabaya, Indonesia
    MS-Off Ver
    MS 365 (Windows 11 64-bit)
    Posts
    84

    How to copy value from textbox to cell, and auto select cell below?

    Hi All,

    I'm just confuse about simple things, let say i have 1 text box in userform

    how do I copy value or text from textbox in a userform and paste it to a cell and auto select cell below after that?

    and also the copy paste stopped if certain row was reached. example : I can copy paste & auto select below within A1:A20, but after A20, it won't be possible to copy paste to A21.

    Copy value/text triggered by command button click

    thanks a lot for the help

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,661

    Re: How to copy value from textbox to cell, and auto select cell below?

    Option Explicit
    Sub commandbutton_click()
        Dim nextcell As Long
        
        nextcell = Cells(Rows.Count, "A").End(xlUp).Row + 1
        If nextcell > 21 Then Exit Sub
        Cells(nextcell, "A").Value = TextBox.Value
    End Sub
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    11-12-2015
    Location
    Surabaya, Indonesia
    MS-Off Ver
    MS 365 (Windows 11 64-bit)
    Posts
    84
    Quote Originally Posted by protonLeah View Post
    Option Explicit
    Sub commandbutton_click()
        Dim nextcell As Long
        
        nextcell = Cells(Rows.Count, "A").End(xlUp).Row + 1
        If nextcell > 21 Then Exit Sub
        Cells(nextcell, "A").Value = TextBox.Value
    End Sub
    Hi Proton Leah,

    Thanks for the help, it works... Thank You Sooooooo Much

    Sorry for the late reply, i just tested the code.
    Cheers

  4. #4
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: How to copy value from textbox to cell, and auto select cell below?

    Cross-posted at: http://www.mrexcel.com/forum/excel-q...ell-below.html
    Please read our policy on Cross-Posting in rule #8: http://www.excelforum.com/forum-rule...rum-rules.html
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Select 1 cell in a range -> copy to new cell (still keeping formatting)
    By Tildish in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-14-2013, 07:19 AM
  2. [SOLVED] Auto Update Price in a userforms textbox or label when a cell value changes
    By VBTroubles in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2013, 01:49 AM
  3. [SOLVED] Macro to auto select adjacent cell then cell underneath
    By strud in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-21-2013, 05:48 AM
  4. Auto increment textbox value to next open cell
    By chriscoetser in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-11-2012, 07:21 AM
  5. Find specific value in a cell, select the cell and copy all cells beneath
    By Mothman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2010, 03:26 AM
  6. Replies: 4
    Last Post: 05-19-2010, 10:14 AM
  7. Auto Select Cell Value
    By lockye in forum Excel General
    Replies: 19
    Last Post: 11-18-2008, 05:40 PM
  8. Replies: 1
    Last Post: 12-30-2005, 09:35 AM

Tags for this Thread

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