Results 1 to 5 of 5

Macro Question

Threaded View

  1. #1
    Registered User
    Join Date
    01-27-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    2

    Macro Question

    Hi all,

    registered just to ask this question as its fustrating me. I have some knowledge of how VB works - i did a module on it in college (years ago!) but have forgoten everything. i dont use excel or vb everyday - which is why this question will probs be easy to some people.

    I am trying to do a very simple macro button.

    I want to be able to click the button and for it to fill in a cell with a colour and a boarder. Also one to delete everything so its a blank 'skeleton' worksheet.

    The problem i have is that the code below is looking at cell Q13. I want to be able to manually sellect the cell. Is there code for this or there maybe a different way of writing the code, however ive forgotten all the useful stuff from college.

    Sub Projected_Time()
    '
    ' Projected_Time Macro
    ' Fill cell with grey box
    '
    ' Keyboard Shortcut: Ctrl+d
    '
        Range("Q13").Select
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .ThemeColor = xlThemeColorDark1
            .TintAndShade = -0.499984740745262
            .PatternTintAndShade = 0
        End With
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        With Selection.Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlInsideVertical)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlInsideHorizontal)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
    End Sub

    I think making the clear sheet button will be alot easier :D but if someone can help me with the top line of this code i would be very greatful.

    Thanks
    Last edited by Dowsett; 01-27-2012 at 08:12 AM. Reason: mods...

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.6.0 RC 1