Hello
I'm new to using anything beyond simple copy paste functions in VBA. I want to do a sumif calculation using VBA where the output is values pasted in a defined range.
The goal is to copy a values in range with a fixed set of dates to another range which has more dates but have those values align with the column in which their original dates.
[TABLE="width: 600"]
<tbody>[TR]
[TD]31-Jan-18[/TD]
[TD]28-Feb-18[/TD]
[TD]31-Mar-18[/TD]
[TD]30-Apr-18[/TD]
[TD]31-May-18[/TD]
[TD]DatePaste[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]2[/TD]
[TD][/TD]
[TD]3[/TD]
[TD][/TD]
[TD]RangePaste[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]31-Jan-18[/TD]
[TD]28-Feb-18[/TD]
[TD]30-Apr-18[/TD]
[TD]DateCopy[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]ValuesCopy[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The code I am using is in the latest excel :
I am new to this syntax on what is required to adapt this, if you could please show me how to make this work that would be amazing.
Thank you
X
I'm new to using anything beyond simple copy paste functions in VBA. I want to do a sumif calculation using VBA where the output is values pasted in a defined range.
The goal is to copy a values in range with a fixed set of dates to another range which has more dates but have those values align with the column in which their original dates.
[TABLE="width: 600"]
<tbody>[TR]
[TD]31-Jan-18[/TD]
[TD]28-Feb-18[/TD]
[TD]31-Mar-18[/TD]
[TD]30-Apr-18[/TD]
[TD]31-May-18[/TD]
[TD]DatePaste[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]2[/TD]
[TD][/TD]
[TD]3[/TD]
[TD][/TD]
[TD]RangePaste[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]31-Jan-18[/TD]
[TD]28-Feb-18[/TD]
[TD]30-Apr-18[/TD]
[TD]DateCopy[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]ValuesCopy[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The code I am using is in the latest excel :
Code:
Sub SumIFPaste()
Dim RangePaste As Range
Dim Datecopy As Range
Dim DatePaste As Variant
Dim ValuesCopy As Range
RangePaste = Application.WorksheetFunction.SumIf(Datecopy, DatePaste, ValuesCopy)
End Sub
Thank you
X