+ Reply to Thread
Results 1 to 3 of 3

Thread: format hyperlink to run macro

  1. #1
    Registered User
    Join Date
    03-16-2009
    Location
    italy
    MS-Off Ver
    Excel 2003
    Posts
    63

    format hyperlink to run macro

    i need some help with the macro below from stop and question mark on;
    i can't make the cell format that has start written to be visible thanks a lot



    Private Sub Workbook_Open()
    
      Dim myRng As Range
      Dim myCell As Range
      Dim curWks As Worksheet
      Dim myRect As Shape
      Dim iCol As Integer
      iCol = 1  '1 columns (or in this case one cell)
    
      Set curWks = ActiveSheet
    
      With curWks
        'the cell you want to click on
        Set myRng = .Range("a1").Resize(1, iCol)
        For Each myCell In myRng.Cells
            With myCell
              Set myRect = .Parent.Shapes.AddShape _
                  (Type:=msoShapeRectangle, _
                  Top:=.Top, Height:=.Height, _
                  Width:=.Width, Left:=.Left)
            End With
            With myRect
    ' change the macro name accordingly
              .OnAction = "b"
             ' .Fill.Visible = False
              .Line.Visible = False
              Stop
              
      '???????????????????????????????????????????????????????????
      Cells(1, 1).Select
        ActiveCell.FormulaR1C1 = "start"
        
        With Selection
            .HorizontalAlignment = xlGeneral
            .VerticalAlignment = xlCenter
            .WrapText = False
            .Orientation = 0
            .AddIndent = False
            .IndentLevel = 0
            .ShrinkToFit = False
            .ReadingOrder = xlContext
            .MergeCells = False
        End With
        With Selection
            .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlCenter
            .WrapText = False
            .Orientation = 0
            .AddIndent = False
            .IndentLevel = 0
            .ShrinkToFit = False
            .ReadingOrder = xlContext
            .MergeCells = False
        End With
        Selection.Font.Bold = True
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .ThemeColor = xlThemeColorDark1
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
        With Selection.Font
            .ThemeColor = xlThemeColorDark1
            .TintAndShade = 0
        End With
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .Color = 5287936
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
            End With
        Next myCell
      End With
      
    End Sub
    Last edited by ilkamalo; 09-05-2010 at 03:28 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & read 2007
    Posts
    15,979

    Re: format hyperlink to run macro

    Hello ilkamalo,

    Can you provide a description of how you want this cell formatted? The code is rather confusing.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    03-16-2009
    Location
    italy
    MS-Off Ver
    Excel 2003
    Posts
    63

    Re: format hyperlink to run macro

    Quote Originally Posted by Leith Ross View Post
    Hello ilkamalo,

    Can you provide a description of how you want this cell formatted? The code is rather confusing.
    it would be nice that the cell with the link is formatted like the word start as in the desktop of windows xp
    start in white
    the word start in center
    the interior color green
    thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0