+ Reply to Thread
Results 1 to 8 of 8

UserForm information and hidden column references

  1. #1
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    UserForm information and hidden column references

    Good morning,
    Just wondering if this can be resolved. It seems that, when I have hidden columns in my sheet and doing a reference to a column that is hidden, i get an error "Run Time Error 13". But when I unhide the column everything is ok.

    Does this mean I will have to Unhide then once my code runs on my userform, on unload to hide the column again? Is there a workaround with this?

    Userform Code: (Sheet column M is hidden)

    Please Login or Register  to view this content.
    Click the star icon in the lower left part of the contributor's post and add Reputation if we have helped you .

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: UserForm information and hidden column references

    Works fine for me when column M is hidden as long as value in the active row of column M is numeric and I use Value instead of Text here.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: UserForm information and hidden column references

    So weird, I searched online and looks like it’s a mystery. Some people close the workbook and re-open it, and presto. But I’ve been doing this several time and still getting the error. (Type Mismatch).

    I do have a numeric in my Range("M" & ActiveCell.Row) but when hidden an error occur and when I unhide the column, it works perfect.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,265

    Re: UserForm information and hidden column references

    As Norie said, don't use .Text, use .Value
    Remember what the dormouse said
    Feed your head

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: UserForm information and hidden column references

    Did you try changing Text to Value as I suggested?

    You only really use Text with cells when you want to get the value in the cell as it's formatted, eg if the cell had a date/currency value.

  6. #6
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: UserForm information and hidden column references

    Yeah well that is one of the problem... I have a format of "000" to two of these so will try to add format...

    Now it's not givin me the error, thank you Norie and romperstomper for this change. Now it gets my

    Label11.Caption = "Previous Contract was " & Range("A" & ActiveCell.row) & "/" & Range("M" & ActiveCell.row).text & "/HS" but adding the format as 1 and not 001.

    Will try and figure this one out

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: UserForm information and hidden column references

    You are using Text in that line of code.

    If you want the textbox to display with leading zeroes try this.
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: UserForm information and hidden column references

    Yup was going to post the same thing

    Thank you guys

+ 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. Replies: 1
    Last Post: 06-21-2013, 01:41 AM
  2. showing the userform again when userform hasn't been hidden or unloaded
    By stanigator in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-10-2007, 09:33 PM
  3. Replies: 0
    Last Post: 09-27-2006, 02:05 PM
  4. Information hidden when I press F2
    By Gazzr in forum Excel General
    Replies: 1
    Last Post: 04-20-2006, 09:30 AM
  5. [SOLVED] How do I paste information to hidden worksheets?
    By sir Lancelot in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-20-2005, 12:50 PM

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