Code Please That Could Save Me Hours

Dazzawm

Well-known Member
Joined
Jan 24, 2011
Messages
3,786
Office Version
  1. 365
Platform
  1. Windows
I need a code that will look at any data that is in column AG and copy it 1 row up and 5 columns to the left (AB) but only if the destination cell has NYA in it. Is this possible please? Thanks
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I suspect this is the cause (although it wouldn't hurt if it actually gave us a meaningful error description! :biggrin:).

I have something else up my sleeve. One mo....
 
Upvote 0
Code:
Public Sub OogaBoogaSnort()
    With ActiveSheet
        With Intersect(.Columns("AB"), .UsedRange)
            .Value = Evaluate("if(row(),if(" & .Address & "=""NYA"",if(len(" & .Offset(1, 5).Address & ")," & .Offset(1, 5).Address & ",""NYA""),""""))")
        End With
    End With
End Sub
 
Upvote 0
That copied over as I wanted but.... It deleted everything in a cell in column AB that didnt have NYA in it
 
Upvote 0
whooooops

Code:
Public Sub OogaBoogaSnort()
    With ActiveSheet
        With Intersect(.Columns("AB"), .UsedRange)
            .Value = Evaluate("if(row(),if(" & .Address & "=""NYA"",if(len(" & .Offset(1, 5).Address & ")," & .Offset(1, 5).Address & ",""NYA"")," & .Address & "))")
        End With
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,564
Messages
6,179,543
Members
452,924
Latest member
JackiG

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