Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using ShadeAlternate Subroutines as Macro

I located the exact tip I was looking for in ExcelTip for shadin
alternate rows. What I need to do is select the rows and columns
want shaded and then call a macro to do the job. I found the tip a
the following URL:

http://www.exceltip.com/st/Row_and_c...Excel/488.html

For me, the problem is that they are written as subroutines tha
require arguments to operate. Can someone help me, first time usin
VBA in Excel, to come up with a way to allow me to use the subroutin
to shade the rows in the area that I highlight?

Exceltip.com is a great resource. Not sure why I hadn't found i
before!

Thanks!

Davi

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Using ShadeAlternate Subroutines as Macro

David

the first one could be modified thus:

Sub ShadeAlternateRowsModified()
Dim rngTarget As Range, intColor As Integer, lngStep As Long
' adds a background color = intColor to every lngStep rows in rngTarget
' example: ShadeAlternateRows Range("A1:D50"), 27, 2
' colors every 2 rows light yellow
Dim r As Long
Set rngTarget = Selection
intColor = 27
lngStep = 2
If rngTarget Is Nothing Then Exit Sub
With rngTarget
.Interior.ColorIndex = xlColorIndexNone
' remove any previous shading
For r = lngStep To .Rows.Count Step lngStep
.Rows(r).Interior.ColorIndex = intColor
Next r
End With
End Sub

I'll leave the other to you.

Regards

Trevor


"dbfoxnh " wrote in message
...
I located the exact tip I was looking for in ExcelTip for shading
alternate rows. What I need to do is select the rows and columns I
want shaded and then call a macro to do the job. I found the tip at
the following URL:


http://www.exceltip.com/st/Row_and_c...ng_VBA_in_Micr
osoft_Excel/488.html

For me, the problem is that they are written as subroutines that
require arguments to operate. Can someone help me, first time using
VBA in Excel, to come up with a way to allow me to use the subroutine
to shade the rows in the area that I highlight?

Exceltip.com is a great resource. Not sure why I hadn't found it
before!

Thanks!

David


---
Message posted from http://www.ExcelForum.com/



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
turn off subroutines NDBC Excel Discussion (Misc queries) 3 July 27th 09 01:23 PM
Calling Add-In subroutines from other modules sclark Excel Programming 6 February 3rd 04 05:45 PM
Conceal functions and subroutines? raj Excel Programming 4 November 12th 03 03:40 PM
Duplicate Subroutines Gary Elsner Excel Programming 8 September 14th 03 08:55 PM
Run method for subroutines Scott Excel Programming 1 August 26th 03 04:46 PM


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

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

About Us

"It's about Microsoft Excel"