Posez votre question
Signaler

Macro Magic

Enisea 1Messages postés August 23, 2009Date d'inscription - 7 Sep 2009 à 21:37 - Dernière réponse le 11 Sep 2009 à 23:51 Excelguru
Hello,

I am using Excel 2007.

I need a macro that will cut and paste certain cells from a row based on a cell value in that row. What is cut will be pasted to a different sheet based on the cell value. The original row will be deleted and removed.

Source Sheet is "APPLICATIONS"
Destination Sheet 1 is "FUNDINGS"
Destination Sheet 2 is "DENIALS"

If the value in Column H is "Funded" Move columns A:X from active row to first empty row on destination sheet 1.
If the value in Column H is "Denied" Move columns A:X from active row to first empty row on destination sheet 2.

1. Source sheet has headings in row 1 and 2 so it will start checking the data in row 3.
2. Column G does have empty cells.
3. Destination sheet has headings in the first few rows, so the data will start pasting in the first available row after the fifth row.

So far, this is what I have..


Sub test()
Dim rng As Range, c As Range, dest As Range
With Worksheets("APPLICATIONS")
Set rng = Range(.Range("H5"), .Cells(Rows.Count, "H").End(xlUp))
For Each c In rng
If c = "FUNDED" Then
c.EntireRow.Copy
With Worksheets("FUNDINGS")
Set dest = .Cells(Rows.Count, "a").End(xlUp).Offset(1, 0)
dest.PasteSpecial
End With
ElseIf c = "DENIED" Then
c.EntireRow.Copy
With Worksheets("DENIALS")
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

This works, but I how can I cut and paste rather than copy and paste, and/or delete the original row in the worksheet?

Also, is there a way to copy a specific column range of the row, instead of the entire row?

Please help.Configuration: Windows Vista Firefox 3.5.2
Lire la suite ...
Ajouter un commentaire

Meilleures réponses

 Macro Magic - Rechercher

 Network magic license key - Forum

Best answer: Dude remove the NM from ADD/REMOVE programs, it's no use ... just remove it

 Partition magic freeware - Tips

Free alternative to Partition Magic Intro Links Intro Today there are several freeware/free equivalent to partition your disk, providing same outstanding performances as Partition magic. Links Here is a selection of the best...

 Network magic license key - Forum

Best answer: You wont find the correct answer so dont try it wont work they just want you to give them ur money

 Excel macro Range - Forum

Hello, I have a macro that chooses dates from a field which is a general download from our information system. It then sorts the dates Ascending, and puts in a True False formula to see if any of the dates are repeated. It then copy pastes values the...

 Excel macros for beginners - Forum

Best answer: http://www.anthony-vba.kefra.com/vba/vbabasic2.htm -- tutorial

 Register your magic jack - Forum

Best answer: I had the same problem. I tried the upgrade of Magicjack software upgrade. it worked. please see below link for upgradig Magicjack software http://upgrades.magicjack.com/upgrade/upgrade.exe

 Excel macro activecell - Forum

Best answer: Hi, I've tried something in this style, Sub () Worksheets("Sheet1").Activate Range("A1:D10").Select If active.cell.selected Then Selection.Copy Sheets("Sheet1").Select Range("A1:M1").Select ActiveSheet.Paste Else End If End Sub I manage to ge

 Can i change my magic jack phone number - Forum

Best answer: Here is how I was able to change my area code and phone number during a MagicJack Webchat support session: Hannah: Hello, how may I help you? larry Hawkins: Thank you Hannah: Hello Larry. Hannah: May I know your concern please? larry Hawkins:

 Magic DVD Copier - Download

As its name suggests, Magic DVD Copiere is a simple software to rip your DVD. This tool can help you copy any DVD to blank DVD without quality loss. Just insert your DVD movie and a blank DVD, then press Go, and the rest is done automatically, you get...

 Magic Boss Key - Download

Magic Boss Key allows you to hide an active program when using a hotkey. With this software, it is easy to hide your browser window, folder window, Windows application, all the icons and tool bars to keep them away from curious people. Its high speed with very low memory consumption allows you to hide quickly a window when you are obliged. It is possible to hide your windows with a combination of secret keys, then you can restore all applications exactly to the same state. Th

 Magic Speed Demo - Download

Magic Speed is a program that will make your PC faster startup and operation. The software performs the analysis of applications loaded when you start your PC, repair registry errors, cleaning the disc (removing temporary files), and memory...

 Philips Magic 5 Colour Dect - Buying guide

 Philips Magic 5 Voice - Buying guide

 Philips Magic 5 Primo - Buying guide

 Excel - Run Macro on Cell Change - Tips

Excel - Run Macro on Cell Change Issue Solution Note Issue I am trying to have 1 of 8 different macro's run depending on the value of a specific cell. If I enter 1 in cell A3, I would like macro1 to run. If I change cell A3 to 2, I...

Trier par :   Vote | Date | Date décroissante 5 réponses
+0
moins plus
Dear Enisea

Now with your code you have copied and pasted
Add the same code with changes for deletion at the end of the procedure (include c.EntireRow.delete instead of copy, exclude all pastespecial statements)

Try deleting from last row to first row if you face any difficulty
Enisea - 9 Sep 2009 à 22:28
I almost have all this figured out... I appreciate your help.

Is this what your talking about?

Sub MoveMerchant()
Dim rng As Range, c As Range, dest As Range
With Worksheets("SUBMISSIONS")
Set rng = Range(.Range("H5"), .Cells(Rows.Count, "H").End(xlUp))
For Each c In rng
If c = "FUNDED" Then
c.EntireRow.Copy
With Worksheets("FUNDINGS")
Set dest = .Cells(Rows.Count, "a").End(xlUp).Offset(1, 0)
dest.Paste
c.EntireRow.Delete
End With
ElseIf c = "DENIED" Then
c.EntireRow.Copy
With Worksheets("DENIALS")
Set dest = .Cells(Rows.Count, "a").End(xlUp).Offset(1, 0)
dest.Paste
c.EntireRow.Delete
End With
End If
Next c
End With
Application.CutCopyMode = False
End Sub

This is not working.
Ajouter un commentaire
+0
moins plus
Use Range("SomeSource").Cut Destination:=Range("SomeDestn")
Enisea - 9 Sep 2009 à 22:29
Use Range("SomeSource").Cut Destination:=Range("SomeDestn")

Would this be referring to only copying a specific column range?

i.e.

Use Range("A").Cut Destination:=Range("X")

OR

Use Range("A:A").Cut Destination:=Range("X:X")
Ajouter un commentaire
+0
moins plus
try yourself
Columns("B:B").Cut Destination:=Columns("D:D")
Ajouter un commentaire
A voir également