Im in a VB mess

pickwa

Board Regular
Joined
Jun 6, 2011
Messages
54
Hi Guys,

I have a speadsheet that is going to tell me when to send out letters to people.

i am trying to create a status box

when a date is entered into a cell(date of letter sent) the status box says one thing. eg 'letter sent'

then(this is where i got stuck) one month later i want the status box to automatically change to somthing else "pass on"

i currently have it so it changes 30 years after i think????

i really am clueless when it comes to VB and this is litterally the last thing i need to complete my spreadsheet.

if anyone could show me how to change my script it would be massively apprecaited because im completely stumped/clueless

cheers,

Pickwa

ive included all of my script below it make make it clearer what i am trying to achieve.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count <> 1 Then Exit Sub
If Target.Column = 10 Then
If Target.Value > 0 Then Target.Offset(0, -1).Value = "processing"
End If
If Target.Column = 11 Then
If Target.Value = "No" Then Target.Offset(0, -2).Value = "Send 1st Letter"
If Target.Value = "Yes" Then Target.Offset(0, -2).Value = "Case Closed"
End If
If Target.Column = 12 Then
If Target.Value <> "" Then Target.Offset(0, -3).Value = "1st letter sent"
If Target.Value > Date - 30 Then Target.Offset(0, -3).Value = "send Charge Letter"
End If
If Target.Column = 13 Then
If Target.Value <> "" Then Target.Offset(0, -4).Value = "Charge Letter Sent"
If Target.Value > Date - 30 Then Target.Offset(0, -4).Value = "Send Surcharge Leter"
End If
If Target.Column = 14 Then
If Target.Value > "0" Then Target.Offset(0, -5).Value = "Surcharge Letter Sent"
If Target.Value > Date - 30 Then Target.Offset(0, -5).Value = "Pass On"
End If
If Target.Column = 15 Then
If Target.Value >= "0" Then Target.Offset(0, -6).Value = "Case Closed"
End If
If Target.Column = 17 Then
If Target.Value = "YES" Then Target.Offset(0, -6).Value = "Paid"
End If
End Sub <!-- / message -->
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Code:
Private Sub Worksheet_Activate()
Application.EnableEvents = False
Dim rng As Range
Set rng = Range("N1:N" & Range("N65536").End(xlUp).Row)
    For Each cell In rng.Cells
        If Not cell.Value = "" Then
            If Date > cell.Value + 30 Then cell.Offset(0, -5).Value = "Pass On"
        End If
    Next
Application.EnableEvents = True
End Sub

On sheet activation the comment will change if the cell value is older than one month. You can change the triggering event. Possibly Workbook_Open
 
Last edited:
Upvote 0
Sorry to sound stupid but where would i put that in the script?

thanks for helping me you are a lifesaver!
 
Upvote 0
You dont need to paste this in your current script.

Its another Sub that you can paste before or after you current one.

Would look like this:

Code:
Private Sub Worksheet_Activate()
Application.EnableEvents = False
Dim rng As Range
Set rng = Range("N1:N" & Range("N65536").End(xlUp).Row)
    For Each cell In rng.Cells
        If Not cell.Value = "" Then
            If Date > cell.Value + 30 Then cell.Offset(0, -5).Value = "Pass On"
        End If
    Next
Application.EnableEvents = True
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count <> 1 Then Exit Sub
If Target.Column = 10 Then
If Target.Value > 0 Then Target.Offset(0, -1).Value = "processing"
End If
If Target.Column = 11 Then
If Target.Value = "No" Then Target.Offset(0, -2).Value = "Send 1st Letter"
If Target.Value = "Yes" Then Target.Offset(0, -2).Value = "Case Closed"
End If
If Target.Column = 12 Then
If Target.Value <> "" Then Target.Offset(0, -3).Value = "1st letter sent"
If Target.Value > Date - 30 Then Target.Offset(0, -3).Value = "send Charge Letter"
End If
If Target.Column = 13 Then
If Target.Value <> "" Then Target.Offset(0, -4).Value = "Charge Letter Sent"
If Target.Value > Date - 30 Then Target.Offset(0, -4).Value = "Send Surcharge Leter"
End If
If Target.Column = 14 Then
If Target.Value > "0" Then Target.Offset(0, -5).Value = "Surcharge Letter Sent"
If Target.Value > Date - 30 Then Target.Offset(0, -5).Value = "Pass On"
End If
If Target.Column = 15 Then
If Target.Value >= "0" Then Target.Offset(0, -6).Value = "Case Closed"
End If
If Target.Column = 17 Then
If Target.Value = "YES" Then Target.Offset(0, -6).Value = "Paid"
End If
End Sub
 
Upvote 0
Hi sorry i didnt realised you had replied thanks again bro!

Thanks for your help its much appreciated!
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,351
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top