Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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?






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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default error with macro

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

--


Gary


"parteegolfer" wrote
in message news:parteegolfer.25mb0a_1143948901.5059@excelforu m-nospam.com...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default error with macro

Ran for me - xl97

--
Regards,
Tom Ogilvy

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
didn't do much here, but it ran without any errors

--


Gary


"parteegolfer"

wrote
in message

news:parteegolfer.25mb0a_1143948901.5059@excelforu m-nospam.com...

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
naming tab macro error runtime error 1004 D Excel Programming 3 February 28th 05 01:32 AM
Macro 'Automation error' with ChemOffice Excel macro Stew Excel Programming 0 October 27th 03 08:26 PM


All times are GMT +1. The time now is 08:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"