+ Reply to Thread
Results 1 to 3 of 3

255 Character Limit when using Excel 2007 Input Message

Hybrid View

Nic31 255 Character Limit when... 05-29-2014, 07:33 AM
HaHoBe Re: 255 Character Limit when... 05-29-2014, 07:54 AM
nathansav Re: 255 Character Limit when... 05-29-2014, 08:07 AM
  1. #1
    Registered User
    Join Date
    01-15-2014
    Location
    Glasgow
    MS-Off Ver
    Excel 2007
    Posts
    13

    255 Character Limit when using Excel 2007 Input Message

    Hi,

    I am wondering if anyone can help?

    I have created a Change Calendar which uses VBA to pull through Change names which appear when you click on the week:

    Change Calendar.JPG

    The code is working, problem is the 255 character limit in the input message box, is there anyway this limit can be removed or extended?

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Static prevRng As Range
        If Not prevRng Is Nothing Then
            prevRng.Validation.Delete
        End If
        If Intersect(Target, Range("C25:O105")) Is Nothing Then Exit Sub
        If Target.Count > 1 Then Exit Sub
        Set prevRng = Target
        With Target.Validation
    
    
    If ActiveCell.Row < 43 Then GoTo 1 Else
    If ActiveCell.Row < 65 Then GoTo 2 Else
    If ActiveCell.Row < 87 Then GoTo 3 Else
    If ActiveCell.Row < 109 Then GoTo 4 Else
        
        
        '''''''''''''''''''''Q1 Area
    1
    
        If Not prevRng Is Nothing Then
            prevRng.Validation.Delete
        End If
        If Intersect(Target, Range("C25:O39")) Is Nothing Then Exit Sub
        If Target.Count > 1 Then Exit Sub
        Set prevRng = Target
        With Target.Validation
        
        mcol = -ActiveCell.Column + 2
        mcol2 = -ActiveCell.Column + 1
        
       myvar = Cells(24, ActiveCell.Column)
        Range("E7") = myvar
       rvar = ActiveCell.Offset(0, mcol)
         Range("E10").Value = ""
       Range("E8").Value = ""
       Range("E9").Value = ""
       
       
       
       Range("D6") = rvar
       rvar2 = ActiveCell.Offset(0, mcol2)
       Range("C6") = rvar2
       
        
        .Delete
        .Add xlValidateInputOnly
        .InputMessage = Range("F6")
     
        End With
        
      ''''''''''''''''''''''''''''''''''''''Q2 Area
    2
        If Not prevRng Is Nothing Then
            prevRng.Validation.Delete
        End If
        If Intersect(Target, Range("C47:O61")) Is Nothing Then Exit Sub
        If Target.Count > 1 Then Exit Sub
        Set prevRng = Target
        With Target.Validation
        
        mcol = -ActiveCell.Column + 2
        mcol2 = -ActiveCell.Column + 1
        
       myvar = Cells(46, ActiveCell.Column)
        Range("E7") = myvar
       rvar = ActiveCell.Offset(0, mcol)
         Range("E10").Value = ""
       Range("E8").Value = ""
       Range("E9").Value = ""
       
       Range("D6") = rvar
       rvar2 = ActiveCell.Offset(0, mcol2)
       Range("C6") = rvar2
       
        
        .Delete
        .Add xlValidateInputOnly
        .InputMessage = Range("F6")
      
        End With
        
        ''''''''''''''''''''''''''''''''''''''Q3 Area
    3
        If Not prevRng Is Nothing Then
            prevRng.Validation.Delete
        End If
        If Intersect(Target, Range("C69:O83")) Is Nothing Then Exit Sub
        If Target.Count > 1 Then Exit Sub
        Set prevRng = Target
        With Target.Validation
        
        mcol = -ActiveCell.Column + 2
        mcol2 = -ActiveCell.Column + 1
        
       myvar = Cells(68, ActiveCell.Column)
        Range("E7") = myvar
       rvar = ActiveCell.Offset(0, mcol)
         Range("E10").Value = ""
       Range("E8").Value = ""
       Range("E9").Value = ""
       
       
       
       Range("D6") = rvar
       rvar2 = ActiveCell.Offset(0, mcol2)
       Range("C6") = rvar2
       
        
        .Delete
        .Add xlValidateInputOnly
        .InputMessage = Range("F6")
      
        End With
        
        
       ''''''''''''''''''''''''''''''''''''''Q4 Area
    4
        If Not prevRng Is Nothing Then
            prevRng.Validation.Delete
        End If
        If Intersect(Target, Range("C91:O105")) Is Nothing Then Exit Sub
        If Target.Count > 1 Then Exit Sub
        Set prevRng = Target
        With Target.Validation
        
        mcol = -ActiveCell.Column + 2
        mcol2 = -ActiveCell.Column + 1
        
       myvar = Cells(90, ActiveCell.Column)
        Range("E10") = myvar
       rvar = ActiveCell.Offset(0, mcol)
       
       Range("E7").Value = ""
       Range("E8").Value = ""
       Range("E9").Value = ""
       
       
       Range("D6") = rvar
       rvar2 = ActiveCell.Offset(0, mcol2)
       Range("C6") = rvar2
       
        
        .Delete
        .Add xlValidateInputOnly
        .InputMessage = Range("F6")
      
        End With
            End With
    End Sub
    Last edited by Nic31; 05-29-2014 at 11:14 AM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: 255 Character Limit when using Excel 2007 Input Message

    Hi, Nic31,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: 255 Character Limit when using Excel 2007 Input Message

    HI,

    I dont think there is to be honest with you.

    YOu could bypass it and do it yourself, so if intersect(target,Target.Worksheet.UsedRange.SpecialCells(xlCellTypeAllValidation)) to tell you if it has validation.
    Then handle the rest using a normal message box and logic.

    I've written some custom validation using event sinking before now, you can tdo this in Excel 2010 using the worksheet_change event to do so.


    Event sinking (older versions) would be something like

    In a class, then on workbook open pass each sheet to the class....

    
    Private WithEvents WS As Excel.Worksheet
    
    Public Sub INIT(wsP As Excel.Worksheet)
    
    Set WS = wsP
    
    End Sub
    
    Private Sub WS_SelectionChange(ByVal Target As Range)
    
    Dim r As Range
    
    Set r = Target.Worksheet.UsedRange.SpecialCells(xlCellTypeAllValidation)
    
    If Intersect(r, Target) Is Nothing Then
        MsgBox String(500, "*")
    End If
    
    End Sub
    Using this event is probably a good place to put it.

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    
    End Sub
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

+ 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] limit character input
    By burugudug in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-05-2010, 07:56 AM
  2. Beating a message box character limit
    By duckboy1981 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-06-2009, 11:11 AM
  3. Replies: 0
    Last Post: 10-31-2007, 10:00 AM
  4. [SOLVED] Character limit in an Excel Row
    By Denise in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-05-2005, 10:05 PM
  5. Excel Character Limit
    By svoorhies in forum Excel General
    Replies: 3
    Last Post: 06-02-2005, 11:48 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