![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Microsoft Office support MS Office support forum |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |
|
Registered User
Join Date: Jun 2009
Posts: 1
OS: XP
|
Excel VBA help
Hi guys,
Wondering if someone can help me with my VBA code. Basically what I have is a marketing promotional schedule on Sheet1 with dates running from B3:GS3, and the promotion name running in A4:A30. When "Event Held" is entered in any cell that is an intersection of those ranges, I want the code to add reminder notices at weekly intervals starting from 8 weeks prior to the date, and every week thereafter, color-coded as per the code. The below code works, but not for every instance of "Event Held" in the above range. How can I 'tweak' the code to get it working? Quote:
|
|
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Registered User
Join Date: May 2008
Location: Baltimore, Maryland
Posts: 160
OS: Windows XP SP3
|
Re: Excel VBA help
Here's another approach.
Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim idx As Long
If Not (Intersect(Target, Range("B4:GS30")) Is Nothing) Then
If LCase(Target.Cells(1, 1).Value) = "event held" Then
For idx = -56 To -7 Step 7
If (Target.Column + idx) > 1 Then
With Cells(Target.Row, Target.Column + idx)
.Value = idx / -7 & " Week" & IIf(Not (idx / -7) = 1, "s", "")
If (idx / -7) = 8 Then
.Interior.Color = RGB(255, 153, 204)
Else
.Interior.Color = RGB(255, 204, 153)
End If
End With
End If
Next idx
End If
End If
End Sub
|
|
|
|
![]() |
| Thread Tools | |
|
|