+ Reply to Thread
Results 1 to 7 of 7

Problems with creating TextBox shapes to a selection using VBA

  1. #1
    Registered User
    Join Date
    02-19-2015
    Location
    Manchester, England
    MS-Off Ver
    MS Office 2010
    Posts
    3

    Problems with creating TextBox shapes to a selection using VBA

    Hi All,

    I'm having trouble trying to create text box shapes onto a spreadsheet and entering the data from a userform without it affecting all other textboxes on the worksheet, could anybody help me out? The code i use to create the text boxes is as follows:

    If TypeName(Selection) = "Range" Then
    With Selection
    ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, .Left, .Top, .Width, .Height).Select
    End With
    With Selection
    .Text = TextBox1.Text + " " + TextBox2.Text
    End With
    End If

    Thanks in advance

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Problems with creating TextBox shapes to a selection using VBA

    Don't usually like to use Section when running code from a userform.
    Is the range for the textbox a variable?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-19-2015
    Location
    Manchester, England
    MS-Off Ver
    MS Office 2010
    Posts
    3

    Re: Problems with creating TextBox shapes to a selection using VBA

    Hi Dave,

    Thank you for the reply. The range for the textbox is where ever the user selects on the worksheet. I'm trying to create a production board that shows how long a job is in a machine and the user will have the ability to move the job onto another machine if required, would you like me to send you the file for you to see what happens?

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Problems with creating TextBox shapes to a selection using VBA

    Not really, you have your code, you can change it to activecell

  5. #5
    Registered User
    Join Date
    02-19-2015
    Location
    Manchester, England
    MS-Off Ver
    MS Office 2010
    Posts
    3

    Re: Problems with creating TextBox shapes to a selection using VBA

    Will activecell still let you use a range of cells for the textbox or will it create a seperate textbox for each cell?

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Problems with creating TextBox shapes to a selection using VBA

    Ah, so you want a textbox for each cell in a selection?

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Problems with creating TextBox shapes to a selection using VBA

    Here's 2 options, textbox for each cell in selection, or 1 big textbox

    Please Login or Register  to view this content.

+ 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] TextBox turns into a rectangle when using AvtiveSheet.Shapes
    By sur4j in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-06-2014, 04:35 PM
  2. Problems creating a shape textbox in word 2010
    By tfurnivall in forum Word Formatting & General
    Replies: 8
    Last Post: 12-17-2012, 10:53 PM
  3. [SOLVED] Move all selected shapes (images,textbox,etc) simultaneously
    By jonelamora in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-25-2012, 04:54 AM
  4. Programatically control a shapes TextBox
    By Francis Brown in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2005, 02:05 PM
  5. shapes textbox name..
    By PBN in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-23-2005, 06:06 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