code not fully functional

obiwann

Board Regular
Joined
Jan 2, 2014
Messages
142
I have two cells, O14 and U14 that contain variables. The code works when Cell O14=5 and U14 =1 and the code works if O14=3 but when O14=5 and U14 = anything else the last set of code for ELSE: does not run. What am I doing wrong?

Code:
Sub Dump_Data()
 
 If Range("o14").value = 5 And Range("u14") = 1 Then
        Range("dq30").Copy
        Range("f18").Select
        ActiveSheet.Paste Link:=True
        Range("ds30").Copy
        Range("f19").Select
        ActiveSheet.Paste Link:=True
        Range("du5").Copy
        Range("ak19").PasteSpecial
        Range("du6").Copy
        Range("ao19").PasteSpecial
        Range("du7").Copy
        Range("as19").PasteSpecial
        Range("du8").Copy
        Range("aw19").PasteSpecial
        Range("du9").Copy
        Range("ba19").PasteSpecial
        Range("du10").Copy
        Range("be19").PasteSpecial
        Range("dy30").Copy
        Range("a14").PasteSpecial
   
 ElseIf Range("o14").value = 3 Then
        Range("dq30").Copy
        Range("f18").PasteSpecial
        Range("ds30").Copy
        Range("f19").PasteSpecial
        Range("dt30").Copy
        Range("ak19").Select
        ActiveSheet.Paste Link:=True
        Range("du30").Copy
        Range("ao19").Select
        ActiveSheet.Paste Link:=True
        Range("dv30").Copy
        Range("as19").Select
        ActiveSheet.Paste Link:=True
        Range("dy30").Copy
        Range("a14").PasteSpecial
        
 
Else: Range("dq30").Copy
        Range("f18").Select
        ActiveSheet.Paste Link:=True
        Range("ds30").Copy
        Range("f19").Select
        ActiveSheet.Paste Link:=True
        Range("du5").Copy
        Range("ak19").PasteSpecial
        Range("du6").Copy
        Range("ao19").PasteSpecial
        Range("du7").Copy
        Range("as19").PasteSpecial
        Range("du8").Copy
        Range("aw19").PasteSpecial
        Range("du9").Copy
        Range("ba19").PasteSpecial
        Range("du10").Copy
        Range("be19").PasteSpecial
        Range("dy30").Copy
        Range("a14").PasteSpecial
   End If
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I would suggest debug code/run code by using F8 and try to see in that scenario which IF executes.

here about one thing I'm sure that one criteria will run whenever you run this code.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,284
Members
452,902
Latest member
Knuddeluff

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