Excel Macro Help
Closed
Enisea
-
Aug 23, 2009 at 07:36 PM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Sep 7, 2009 at 08:29 PM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Sep 7, 2009 at 08:29 PM
Related:
- Excel Macro Help
- Spell number in excel without macro - Guide
- Excel mod apk for pc - Download - Spreadsheets
- Kernel for excel - Download - Backup and recovery
- Excel marksheet - Guide
- Gif in excel - Guide
3 responses
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Aug 24, 2009 at 09:13 PM
Aug 24, 2009 at 09:13 PM
try this macro and assign any key to this
(you must be already having sheets "applications","funded" and denied"
(you must be already having sheets "applications","funded" and denied"
Sub test() Dim rng As Range, c As Range, dest As Range With Worksheets("applications") Set rng = Range(.Range("G3"), .Cells(Rows.Count, "G").End(xlUp)) For Each c In rng If c = "funded" Then c.EntireRow.Copy With Worksheets("funding") Set dest = .Cells(Rows.Count, "a").End(xlUp).Offset(1, 0) dest.PasteSpecial End With ElseIf c = "denied" Then c.EntireRow.Copy With Worksheets("denied") Set dest = .Cells(Rows.Count, "a").End(xlUp).Offset(1, 0) dest.PasteSpecial End With End If Next c End With Application.CutCopyMode = False End Sub
That worked great.
However, I really need it to cut and paste rather than copy and paste, and/or delete the original row and shift cells up on original worksheet.
Is there any way to do that?
However, I really need it to cut and paste rather than copy and paste, and/or delete the original row and shift cells up on original worksheet.
Is there any way to do that?
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Sep 7, 2009 at 08:29 PM
Sep 7, 2009 at 08:29 PM
modified macro is
Sub test()
Dim rng As Range, c As Range, dest As Range
Dim j As Integer, k As Integer, rng1 As Range
With Worksheets("applications")
Set rng = Range(.Range("G3"), .Cells(Rows.Count, "G").End(xlUp))
For Each c In rng
If c = "funded" Then
c.EntireRow.Copy
With Worksheets("funding")
Set dest = .Cells(Rows.Count, "a").End(xlUp).Offset(1, 0)
dest.PasteSpecial
End With
ElseIf c = "denied" Then
c.EntireRow.Copy
With Worksheets("denied")
Set dest = .Cells(Rows.Count, "a").End(xlUp).Offset(1, 0)
dest.PasteSpecial
End With
End If
Next c
'===========addition
j = .Cells(Rows.Count, "G").End(xlUp).Row
For k = j To 3 Step -1
Set rng1 = .Cells(k, "g")
If rng1 = "funded" Or rng1 = "denied" Then
rng1.EntireRow.Delete
End If
Next k
End With
Application.CutCopyMode = False
End Sub
Sub test()
Dim rng As Range, c As Range, dest As Range
Dim j As Integer, k As Integer, rng1 As Range
With Worksheets("applications")
Set rng = Range(.Range("G3"), .Cells(Rows.Count, "G").End(xlUp))
For Each c In rng
If c = "funded" Then
c.EntireRow.Copy
With Worksheets("funding")
Set dest = .Cells(Rows.Count, "a").End(xlUp).Offset(1, 0)
dest.PasteSpecial
End With
ElseIf c = "denied" Then
c.EntireRow.Copy
With Worksheets("denied")
Set dest = .Cells(Rows.Count, "a").End(xlUp).Offset(1, 0)
dest.PasteSpecial
End With
End If
Next c
'===========addition
j = .Cells(Rows.Count, "G").End(xlUp).Row
For k = j To 3 Step -1
Set rng1 = .Cells(k, "g")
If rng1 = "funded" Or rng1 = "denied" Then
rng1.EntireRow.Delete
End If
Next k
End With
Application.CutCopyMode = False
End Sub