+ Reply to Thread
Results 1 to 6 of 6

Writing into random cell base on textbox values, Error if textbox have Multiple values

  1. #1
    Registered User
    Join Date
    07-02-2019
    Location
    Surabaya, Indonesia
    MS-Off Ver
    Ms. Office 2007
    Posts
    8

    Writing into random cell base on textbox values, Error if textbox have Multiple values

    i'm totally new with VBA and need your help, the problem is i want to select random cells in a given row, as you can see in picture below, the userform have ComboBox X = represent row, TextBox Y=Represent column and CommanButton "Input", i'm stuck with the error when i try to input multiple values separated with comma inside the textbox, as far it only works if the textbox contain a single values within, here is my code :

    Private Sub cbInput_Click()

    Dim x As Variant
    Dim y As Variant

    x = cmbBox_X.Value
    y = txtBox_Y.Value

    With Worksheets.Application.ActiveSheet
    .Cells(x, y).Value = "check" '(error in here when i try with multiple values: runtime error ''13''; type mismatch)
    End With

    End Sub

    SSxy2.png

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,047

    Re: Writing into random cell base on textbox values, Error if textbox have Multiple values

    try this (not tested)

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    07-02-2019
    Location
    Surabaya, Indonesia
    MS-Off Ver
    Ms. Office 2007
    Posts
    8

    Re: Writing into random cell base on textbox values, Error if textbox have Multiple values

    AlphaFrog i got error in "for each y in split(txtbox.val..."

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,047

    Re: Writing into random cell base on textbox values, Error if textbox have Multiple values

    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,047

    Re: Writing into random cell base on textbox values, Error if textbox have Multiple values

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)

    https://www.mrexcel.com/board/thread...value.1130266/

  6. #6
    Registered User
    Join Date
    07-02-2019
    Location
    Surabaya, Indonesia
    MS-Off Ver
    Ms. Office 2007
    Posts
    8

    Re: Writing into random cell base on textbox values, Error if textbox have Multiple values

    thank AlphaFrog thats macro work...

+ 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. [SOLVED] VBA Userform - Lookup/Match Textbox values to prefill other Textbox values
    By Lee_of_Excel in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-26-2020, 06:27 PM
  2. TextBox - Removing Values in Textbox upon click
    By Steve1977 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-15-2019, 05:20 AM
  3. Userform to search textbox value to place other textbox values in worksheet
    By mattyh555 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2012, 11:38 AM
  4. Replies: 5
    Last Post: 11-18-2010, 05:37 PM
  5. Userform: Pass textbox values to another textbox on button press
    By adjustermn in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2010, 11:19 PM
  6. VBA- inserting multiple cell values into single textbox
    By VBA_MAN in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-14-2006, 09:45 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