Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Convert Excel Range to Textbox

  • 10-09-2008 11:56am
    #1
    Closed Accounts Posts: 882 ✭✭✭


    Hi guys, another VB question for ye:

    I have a form that creates a new sheet in excel and it works great. It takes user input from textboxes and populates cells in the excel sheet.

    Now I need to do the reverse of that, but I keep getting a type mismatch error. So how do I convert a cell into a text box?

    I've tried things like this:

    textbox.value=activesheet.range("c1:c3").value

    textbox.value=activesheet.range("c1:c3").text

    and vice versa to no avail.

    anyone?

    thanks in advance!


Comments

  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    You're trying to extract a value from a range - a range doesn't have one. Afaik, the range function returns a collection of cells.

    What kind of information are you dealing with - i.e what are you expecting to extract from the sheet?


  • Closed Accounts Posts: 882 ✭✭✭cunnins4


    Thanks seamus, you actually triggered the answer indirectly!

    Basically my vb form takes user input and uses it to fill in a sheet that's been formatted to look like another form, but my boss wants that to be locked so that no one can change the formatting in that. Locking the form hasn't worked so my script unlocks the form, fills in the cells, then locks it again. But then it has to be reviewed, so I need to populate another form from the sheet previously completed and allow users to make changes. Long and drawn out, yes, but necessary unfortunately.

    The way the form is formatted it uses merged cells, so instead of using a range, I just use the first cell, in this case "c1" instead of "c1:c3" and it works fine!


    thanks!


Advertisement