Cut and Paste to a new sheet

JiminyKricket

New Member
Joined
May 17, 2011
Messages
8
Hi all,

In my spreadsheet, column G, i have a number of stock tickers, occasionally i will have a currency, written GBP, NOK, SEK, USD etc.. Does anyone know how find them, cut the entire row (deleting the now blank row) and paste into a second worksheet, ensuring that the results get listed and do not overwrite eachother? (then cycles through the remaining rows..)

Any help would be greatly appreciated as i am at work and have been tasked with creating an enormous spreadsheet and have pretty much fallen at the first hurdle!

:confused:

Jiminy
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi all,

In my spreadsheet, column G, i have a number of stock tickers, occasionally i will have a currency, written GBP, NOK, SEK, USD etc.. Does anyone know how find them, cut the entire row (deleting the now blank row) and paste into a second worksheet, ensuring that the results get listed and do not overwrite eachother? (then cycles through the remaining rows..)

Any help would be greatly appreciated as i am at work and have been tasked with creating an enormous spreadsheet and have pretty much fallen at the first hurdle!

:confused:

Jiminy

For a macro this does it, but I know it's not the best way (rushed).

Code:
Sub JiminyKricket()
Dim i As Long
Dim lr As Long


lr = Cells(Rows.Count, 1).End(3).Row

For i = lr To 2 Step -1

    Select Case Range("H" & i).Value
    
        Case Is = "GBP"
        
         Sheets("Destination").Range("A2").EntireRow.Insert SHIFT:=xlDown
    
    
        Range("H" & i).EntireRow.Cut Sheets("Destination").Range("A2")
   
        Case Is = "NOK"
        
        Sheets("Destination").Range("A2").EntireRow.Insert SHIFT:=xlDown
    
    
        Range("H" & i).EntireRow.Cut Sheets("Destination").Range("A2")
        
        Case Is = "SEK"
        
        Sheets("Destination").Range("A2").EntireRow.Insert SHIFT:=xlDown
    
    
        Range("H" & i).EntireRow.Cut Sheets("Destination").Range("A2")

        Case Is = "USD"

        Sheets("Destination").Range("A2").EntireRow.Insert SHIFT:=xlDown
    
    
        Range("H" & i).EntireRow.Cut Sheets("Destination").Range("A2")
    
    
        End Select
        
Next i


End Sub
 
Upvote 0
Ah your a star! i spent the afternoon playing with nested 'If or' statements and just couldnt get it to work!

i do have one last question though..

once the row has been cut and pasted to the new sheet (works perfectly btw) is there a way i can delete that row (now blank) on the original sheet?

so far i have..

Dim i As Long
Dim lr As Long

lr = Cells(Rows.Count, 1).End(3).Row
For i = lr To 2 Step -1
Select Case Range("G" & i).Value

Case Is = "AUD"

Sheets("Cash Items").Range("A2").EntireRow.Insert SHIFT:=xlDown

'repeated for each currency

End Select

Next i

End Sub


Thanks for your help
 
Upvote 0
Ah your a star! i spent the afternoon playing with nested 'If or' statements and just couldnt get it to work!

i do have one last question though..

once the row has been cut and pasted to the new sheet (works perfectly btw) is there a way i can delete that row (now blank) on the original sheet?

so far i have..

Dim i As Long
Dim lr As Long

lr = Cells(Rows.Count, 1).End(3).Row
For i = lr To 2 Step -1
Select Case Range("G" & i).Value

Case Is = "AUD"

Sheets("Cash Items").Range("A2").EntireRow.Insert SHIFT:=xlDown

'repeated for each currency

End Select

Next i

End Sub


Thanks for your help

Like this perhaps:

Code:
    Select Case Range("H" & i).Value
    
        Case Is = "GBP"
        
         Sheets("Destination").Range("A2").EntireRow.Insert SHIFT:=xlDown
    
    
        Range("H" & i).EntireRow.Cut Sheets("Destination").Range("A2")
      
        Range("H" & i).EntireRow.Delete Shift:=xlUp

Add the last line between each Case. Hope I've been clear.
 
Upvote 0

Forum statistics

Threads
1,224,581
Messages
6,179,668
Members
452,936
Latest member
anamikabhargaw

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