Need a VBA function

yogeshmaney

Active Member
Joined
Feb 25, 2010
Messages
321
Hi,

I need a VBA function to copy the Row Array and paste it from given cell at offset value

Suppose

SourceArray= Range("A1:G1")
DestCell = Range("D4")
OffSetValue= Range("A3")

Need a Function like

CopyArray(SourceArray,DestCell,OffsetValue)

So the Source Array should get printed from Dest Cell at offset value which is 3 ( as the value varies the array should move)




A B C D E F G
1 2 4 6 0 0 0 0
2 0 0 0 0 0 0 0
3 3 0 0 0 0 0 0
4 0 0 0 0 0 0 0
5 0 0 0 2 4 6 0
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try putting this in the Worksheet module:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Intersect(Target, Range("A3")) Is Nothing Then
        Range("A1:G1").Copy Destination:=Range("D4").Offset(Range("A3").Value, 0)
    End If
 
Upvote 0
Or, yet untested:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$3" Then [D4].Offset([A3]).Value = [A1:G1]
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,941
Members
449,094
Latest member
teemeren

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