Link to home
Start Free TrialLog in
Avatar of excel help
excel help

asked on

I want to scroll a message on Excel

There is a message " Due to high inflow of call talk times were impacted " .... As soon anyone opens my excel attachment I want this message to scroll from left to right and keep scrolling on the screen
ASKER CERTIFIED SOLUTION
Avatar of Mike in IT
Mike in IT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of excel help
excel help

ASKER

Thank you Mike ..This does resolve the issue , however the message only displays only one word at a time , so I tried to merge the cells and  amend the code  slightly ... Set tcell= Range ( "A10:D10")  so that I can see the entire message all at once and then it keeps scrolling throughout , for example I want it to display in cell D2:I2 .. Any insight would be appreciated
Avatar of Shaun Vermaak
Tested this. I would just make the width wider
Sub DoMarquee()
    Dim sMarquee As String
    Dim iWidth As Integer
    Dim iPosition As Integer
    Dim rCell As Range
    Dim iCurPos As Integer

    'Set the message to be displayed in this cell
    sMarquee = "This is a scrolling Marquee."

    'Set the cell width (how many characters you want displayed at once
    iWidth = 10

    'Which cell are we doing this in?
    Set rCell = Sheet1.Range("M2")

    'determine where we are now with the message.
    '   instr will return the position of the first
    '   character where the current cell value is in
    '   the marquee message
    iCurPos = InStr(1, sMarquee, rCell.Value)

    'If we are position 0, then there is no message, so start over
    '   otherwise, bump the message to the next characterusing mid
    If iCurPos = 0 Then
        'Start it over
        rCell.Value = Mid(sMarquee, 1, iWidth)
    Else
        'bump it
        rCell.Value = Mid(sMarquee, iCurPos + 1, iWidth)
    End If

    'Set excel up to run this thing again in a second or two or whatever
    Application.OnTime Now + TimeValue("00:00:01"), "DoMarquee"
End Sub

Open in new window

https://stackoverflow.com/questions/29394524/make-a-cell-scroll-marquee-text-right-to-left
My code won't work with merged cells. If you want it to be wider then you will have to widen the cell.

I haven't tested @Shaun's VBA, but it looks like it might work with the merged cells better than mine will.
Hey Shaun Unfortunately i t does not work , I changed the width and when I run the code I get a message stating  , The macro may not be available in this workbook or all macros may be disabled ... I checked Trust centre > Trust Centre seetings > Macro setings and it looks fine to me .. Not sure why I am still getting the error message.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: Mike in IT (https:#a42438063)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

broomee9
Experts-Exchange Cleanup Volunteer