Joesif
Board Regular
- Joined
- Feb 23, 2010
- Messages
- 65
Hello,
I am a noob to VBA and macros.
What I am trying to do is copy text into the middle of my formula which is a sumif formula
=SUMIF('[SS.BARCODES_29-07-19_15-47.xlsx]SS.BARCODES_29-07-19_15-47'!$A:$A,"*NEEDDATACOPIEDHERE*",'[SS.BARCODES_29-07-19_15-47.xlsx]SS.BARCODES_29-07-19_15-47'!$B:$B)
My formula is in column D and the text I am copying is on the same line but in column B.
What I have as my macro is
Sub TEST1()
'
' TEST1 Macro
'
' Keyboard Shortcut: Ctrl+Shift+R
'
Range("B10").Select
ActiveCell.FormulaR1C1 = "NEXTCURT10B"
Range("D10").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF('[SS.BARCODES_29-07-19_15-47.xlsx]SS.BARCODES_29-07-19_15-47'!C1,""*NEXTCURT10B*"",'[SS.BARCODES_29-07-19_15-47.xlsx]SS.BARCODES_29-07-19_15-47'!C2)"
Range("D11").Select
End Sub
My issue is that the macro runs the same line each time so I need to move it on to the row below.
Thanks in advance
Joe
I am a noob to VBA and macros.
What I am trying to do is copy text into the middle of my formula which is a sumif formula
=SUMIF('[SS.BARCODES_29-07-19_15-47.xlsx]SS.BARCODES_29-07-19_15-47'!$A:$A,"*NEEDDATACOPIEDHERE*",'[SS.BARCODES_29-07-19_15-47.xlsx]SS.BARCODES_29-07-19_15-47'!$B:$B)
My formula is in column D and the text I am copying is on the same line but in column B.
What I have as my macro is
Sub TEST1()
'
' TEST1 Macro
'
' Keyboard Shortcut: Ctrl+Shift+R
'
Range("B10").Select
ActiveCell.FormulaR1C1 = "NEXTCURT10B"
Range("D10").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF('[SS.BARCODES_29-07-19_15-47.xlsx]SS.BARCODES_29-07-19_15-47'!C1,""*NEXTCURT10B*"",'[SS.BARCODES_29-07-19_15-47.xlsx]SS.BARCODES_29-07-19_15-47'!C2)"
Range("D11").Select
End Sub
My issue is that the macro runs the same line each time so I need to move it on to the row below.
Thanks in advance
Joe