Macro or VB in Excel 2007
Solved/Closed
Jlee1978
Posts
4
Registration date
Monday January 16, 2012
Status
Member
Last seen
January 16, 2012
-
Jan 16, 2012 at 01:26 PM
Blocked Profile - Jan 22, 2012 at 01:38 AM
Blocked Profile - Jan 22, 2012 at 01:38 AM
Related:
- Macro or VB in Excel 2007
- 2007 microsoft office add-in microsoft save as pdf or xps - Download - Other
- Excel online macros - Guide
- Vb net find last row in excel sheet - Guide
- Excel mod apk for pc - Download - Spreadsheets
- Excel run macro on open - Guide
1 response
Jlee1978
Posts
4
Registration date
Monday January 16, 2012
Status
Member
Last seen
January 16, 2012
1
Jan 16, 2012 at 04:41 PM
Jan 16, 2012 at 04:41 PM
OK So I have figured my problem out.
Here is the code I used.
It repeats itself but it does work.
I just need these sheets to sort while they are being updated and everything is good.
Here is the code I used.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nxtRow As Integer
'Determine if change was to Column H (8)
If Target.Column = 8 Then
'If Yes, Determine if cell = Hot
If Target.Value = "H" Then
'If Yes, find next empty row in Sheet 2
nxtRow = Sheets(2).Range("G" & Rows.Count).End(xlUp).Row + 1
'Copy changed row and paste into Sheet 2
Target.EntireRow.Copy _
Destination:=Sheets(2).Range("A" & nxtRow)
'If Yes, find next empty row in Sheet 3
nxtRow = Sheets(3).Range("G" & Rows.Count).End(xlUp).Row + 1
'Copy changed row and paste into Sheet 3
Target.EntireRow.Copy _
Destination:=Sheets(3).Range("A" & nxtRow)
End If
End If
'Determine if change was to Column H (8)
If Target.Column = 8 Then
'If Yes, Determine if cell = Cold
If Target.Value = "C" Then
'If Yes, find next empty row in Sheet 4
nxtRow = Sheets(4).Range("G" & Rows.Count).End(xlUp).Row + 1
'Copy changed row and paste into Sheet 4
Target.EntireRow.Copy _
Destination:=Sheets(4).Range("A" & nxtRow)
'If Yes, find next empty row in Sheet 5
nxtRow = Sheets(5).Range("G" & Rows.Count).End(xlUp).Row + 1
'Copy changed row and paste into Sheet 3
Target.EntireRow.Copy _
Destination:=Sheets(5).Range("A" & nxtRow)
End If
End If
'Determine if change was to Column H (8)
If Target.Column = 8 Then
'If Yes, Determine if cell = Presentation
If Target.Value = "P" Then
'If Yes, find next empty row in Sheet 8
nxtRow = Sheets(8).Range("G" & Rows.Count).End(xlUp).Row + 1
'Copy changed row and paste into Sheet 8
Target.EntireRow.Copy _
Destination:=Sheets(8).Range("A" & nxtRow)
End If
End If
'Determine if change was to Column H (8)
If Target.Column = 8 Then
'If Yes, Determine if cell = Pastry
If Target.Value = "PY" Then
'If Yes, find next empty row in Sheet 10
nxtRow = Sheets(10).Range("G" & Rows.Count).End(xlUp).Row + 1
'Copy changed row and paste into Sheet 10
Target.EntireRow.Copy _
Destination:=Sheets(10).Range("A" & nxtRow)
'If Yes, find next empty row in Sheet 12
nxtRow = Sheets(11).Range("G" & Rows.Count).End(xlUp).Row + 1
'Copy changed row and paste into Sheet 12
Target.EntireRow.Copy _
Destination:=Sheets(11).Range("A" & nxtRow)
End If
End If
'Determine if change was to Column H (8)
If Target.Column = 8 Then
'If Yes, Determine if cell = Bulk
If Target.Value = "B" Then
'If Yes, find next empty row in Sheet 6
nxtRow = Sheets(6).Range("G" & Rows.Count).End(xlUp).Row + 1
'Copy changed row and paste into Sheet 6
Target.EntireRow.Copy _
Destination:=Sheets(6).Range("A" & nxtRow)
End If
End If
End Sub
It repeats itself but it does work.
I just need these sheets to sort while they are being updated and everything is good.
Jan 22, 2012 at 01:38 AM
Thanks for sharing the solution with us.
Regards,
Moderator