+ Reply to Thread
Results 1 to 4 of 4

error with macro

  1. #1
    Registered User
    Join Date
    02-26-2006
    Posts
    68

    error with macro

    I am tring to apply this code which should locate and apply 2 rows below the last entry in the worksheet. I am getting an error in the colored command and can't figuire out why. can someone help please?





    Please Login or Register  to view this content.

  2. #2
    Gary Keramidas
    Guest

    Re: error with macro

    didn't do much here, but it ran without any errors

    --


    Gary


    "parteegolfer" <[email protected]> wrote
    in message news:[email protected]...
    >
    > I am tring to apply this code which should locate and apply 2 rows below
    > the last entry in the worksheet. I am getting an error in the colored
    > command and can't figuire out why. can someone help please?
    >
    >
    >
    >
    >
    >
    > Code:
    > --------------------
    > Sub test()
    > Dim LastR As Range, rng As Range
    > Set LastR = Range("c" & Rows.Count).End(xlUp)
    > Set LastR = LastR.Offset(, -2)
    > Set rng = Union(LastR.Offset(2).Resize(2, 2), LastR.Offset(2, 2).Resize(2,
    > 2), _
    > LastR.Offset(2, 4).Resize(2, 2), LastR.Offset(2, 6).Resize(2, 2))
    > rng.Borders.Weight = xlThick
    > rng.Offset(3).Borders.Weight = xlThick
    > With LastR.Offset(2)
    > .Value = "TOTAL CUSTOMERS"
    > .Font.Bold = True
    > .HorizontalAlignment = xlCenter
    > .VerticalAlignment = xlBottom
    > .Offset(, 2).Value = "TOTAL $95.00"
    > .Offset(, 4).Value = "TOTAL $145.00"
    > .Offset(, 6).Value = "FREE SERVICE"
    > .Offset(3, 2).Value = "PERCENT $95.00 CALLS"
    > .Offset(3, 4).Value = "PERCENT $145.00 CALLS"
    > .Offset(3, 6).Value = "PERCENT FREE"
    > End With
    > Set rng = Nothing
    > End Sub
    > --------------------
    >
    >
    > --
    > parteegolfer
    > ------------------------------------------------------------------------
    > parteegolfer's Profile:
    > http://www.excelforum.com/member.php...o&userid=31951
    > View this thread: http://www.excelforum.com/showthread...hreadid=528936
    >




  3. #3
    Greg Wilson
    Guest

    RE: error with macro

    What do you mean by "colored command"? There is reference having anything to
    do with color in the posted code.

    Regards,
    Greg

    "parteegolfer" wrote:

    >
    > I am tring to apply this code which should locate and apply 2 rows below
    > the last entry in the worksheet. I am getting an error in the colored
    > command and can't figuire out why. can someone help please?
    >
    >
    >
    >
    >
    >
    > Code:
    > --------------------
    > Sub test()
    > Dim LastR As Range, rng As Range
    > Set LastR = Range("c" & Rows.Count).End(xlUp)
    > Set LastR = LastR.Offset(, -2)
    > Set rng = Union(LastR.Offset(2).Resize(2, 2), LastR.Offset(2, 2).Resize(2, 2), _
    > LastR.Offset(2, 4).Resize(2, 2), LastR.Offset(2, 6).Resize(2, 2))
    > rng.Borders.Weight = xlThick
    > rng.Offset(3).Borders.Weight = xlThick
    > With LastR.Offset(2)
    > .Value = "TOTAL CUSTOMERS"
    > .Font.Bold = True
    > .HorizontalAlignment = xlCenter
    > .VerticalAlignment = xlBottom
    > .Offset(, 2).Value = "TOTAL $95.00"
    > .Offset(, 4).Value = "TOTAL $145.00"
    > .Offset(, 6).Value = "FREE SERVICE"
    > .Offset(3, 2).Value = "PERCENT $95.00 CALLS"
    > .Offset(3, 4).Value = "PERCENT $145.00 CALLS"
    > .Offset(3, 6).Value = "PERCENT FREE"
    > End With
    > Set rng = Nothing
    > End Sub
    > --------------------
    >
    >
    > --
    > parteegolfer
    > ------------------------------------------------------------------------
    > parteegolfer's Profile: http://www.excelforum.com/member.php...o&userid=31951
    > View this thread: http://www.excelforum.com/showthread...hreadid=528936
    >
    >


  4. #4
    Tom Ogilvy
    Guest

    Re: error with macro

    Ran for me - xl97

    --
    Regards,
    Tom Ogilvy

    "Gary Keramidas" <GKeramidasATmsn.com> wrote in message
    news:[email protected]...
    > didn't do much here, but it ran without any errors
    >
    > --
    >
    >
    > Gary
    >
    >
    > "parteegolfer" <[email protected]>

    wrote
    > in message

    news:[email protected]...
    > >
    > > I am tring to apply this code which should locate and apply 2 rows below
    > > the last entry in the worksheet. I am getting an error in the colored
    > > command and can't figuire out why. can someone help please?
    > >
    > >
    > >
    > >
    > >
    > >
    > > Code:
    > > --------------------
    > > Sub test()
    > > Dim LastR As Range, rng As Range
    > > Set LastR = Range("c" & Rows.Count).End(xlUp)
    > > Set LastR = LastR.Offset(, -2)
    > > Set rng = Union(LastR.Offset(2).Resize(2, 2), LastR.Offset(2,

    2).Resize(2,
    > > 2), _
    > > LastR.Offset(2, 4).Resize(2, 2), LastR.Offset(2, 6).Resize(2, 2))
    > > rng.Borders.Weight = xlThick
    > > rng.Offset(3).Borders.Weight = xlThick
    > > With LastR.Offset(2)
    > > .Value = "TOTAL CUSTOMERS"
    > > .Font.Bold = True
    > > .HorizontalAlignment = xlCenter
    > > .VerticalAlignment = xlBottom
    > > .Offset(, 2).Value = "TOTAL $95.00"
    > > .Offset(, 4).Value = "TOTAL $145.00"
    > > .Offset(, 6).Value = "FREE SERVICE"
    > > .Offset(3, 2).Value = "PERCENT $95.00 CALLS"
    > > .Offset(3, 4).Value = "PERCENT $145.00 CALLS"
    > > .Offset(3, 6).Value = "PERCENT FREE"
    > > End With
    > > Set rng = Nothing
    > > End Sub
    > > --------------------
    > >
    > >
    > > --
    > > parteegolfer
    > > ------------------------------------------------------------------------
    > > parteegolfer's Profile:
    > > http://www.excelforum.com/member.php...o&userid=31951
    > > View this thread:

    http://www.excelforum.com/showthread...hreadid=528936
    > >

    >
    >




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