+ Reply to Thread
Results 1 to 3 of 3

VBA- inserting multiple cell values into single textbox

  1. #1
    Registered User
    Join Date
    03-14-2006
    Posts
    1

    VBA- inserting multiple cell values into single textbox

    Hi All,

    Just wanted to know the code for inserting 3-4 cells values on a excel sheet into a single text box on a userform. I think it might be the offset property not sure. E.g

    Range A1-D1 need the contents of all those to go into a single text box which is created on a userform. These will automatically be added to the text box when you press a commandbutton on the excel sheet

    help?

    regards

  2. #2
    cheesey_toastie
    Guest

    Re: VBA- inserting multiple cell values into single textbox

    You dont need to use the offset but this is the simpliest way.


    Dim rngmyrange As Range

    'Change the sheet name to the relevant sheet
    Set rngmyrange = ActiveWorkbook.Sheets("Sheet1").Range("A1")

    'change dialogsheets(1).editboxes(1) to represent your userform and
    text box names...
    DialogSheets(1).EditBoxes(1).Text = ngmyrange.Offset(0, 0) &
    rngmyrange.Offset(0, 1) & rngmyrange.Offset(0, 2) &
    rngmyrange.Offset(0, 3)


    ' you might want to add in some spaces or commas ..
    'ngmyrange.Offset(0, 0) & ", " & rngmyrange.Offset(0, 1) etc...


  3. #3
    cheesey_toastie
    Guest

    Re: VBA- inserting multiple cell values into single textbox

    Slight typo...

    Dim rngmyrange As Range

    'Change the sheet name to the relevant sheet
    Set rngMyRange = ActiveWorkbook.Sheets("Sheet1").Range("A1")

    'change dialogsheets(1).editboxes(1) to represent your userform and
    text box names...
    DialogSheets(1).EditBoxes(1).Text = rngMyRange.Offset(0, 0) &
    rngMyRange.Offset(0, 1) & rngMyRange.Offset(0, 2) &
    rngMyRange.Offset(0, 3)

    ' you might want to add in some spaces or commas ..
    'rngMyRange.Offset(0, 0) & ", " & rngMyRange.Offset(0, 1) etc...


+ 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