Please Help! Trying to get my function to repeat for each row of my table range but it only does the first row and stops

sparko92

New Member
Joined
Jul 29, 2022
Messages
3
Office Version
  1. 2021
Platform
  1. Windows
I am very new to macro so this may be a simple fix, hopefully.

The function below (IRRPaybacks123) works perfectly for the first row however I cannot get it to repeat throughout the table.

I have attempted to get it to do in the first Sub LoopAttempt123 but I am missing something

Any and all suggestions greatly appreciated

VBA Code:
Sub LoopAttempt123()
'
' LoopAttempt123 Macro
'
' Keyboard Shortcut: Ctrl+i
'
Dim Table As Range

Set Table = Range("A2", Range("A2").End(xlToRight).End(xlDown))

For Each Row In Table.Rows

End Sub

Function IRRPaybacks123()

    Sheets("New Data").Select
    Range("b2").Select
    Selection.Copy
    Sheets("IRR Format").Select
    Range("I5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("D6").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "='New Data'!R[-4]C[-1]"
    Range("D6").Select
    Selection.Copy
    Range("D7:D8").Select
    ActiveSheet.Paste
    Range("E6").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "='New Data'!R[-4]C"
    Range("H6").Select
    ActiveCell.FormulaR1C1 = "='New Data'!R[-4]C[-2]"
    Range("H6").Select
    Selection.Copy
    Range("H7:H8").Select
    ActiveSheet.Paste
    Range("K10").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("New Data").Select
    Range("H2").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Selection.Style = "Percent"
    Sheets("IRR Format").Select
    Range("L10").Select
    Selection.Copy
    Sheets("New Data").Select
    Range("I2").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Selection.NumberFormat = "0.000000"
    Selection.NumberFormat = "0.00000"
    Selection.NumberFormat = "0.0000"
    Selection.NumberFormat = "0.000"
    Selection.NumberFormat = "0.00"
    Selection.NumberFormat = "0.0"
    Selection.NumberFormat = "0"
    Range("J5").Select
    Sheets("IRR Format").Select
    Range("D6:F8").Select
    Selection.ClearContents
    Range("H5:I8").Select
    Selection.ClearContents
    Sheets("New Data").Select
End Function
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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