How to select multi offset range?

alee001

Board Regular
Joined
Sep 9, 2014
Messages
154
Office Version
  1. 2010
Platform
  1. Windows
How to select multi offset cells in range?Anyone advice me...Thanks.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

With Range("combin_oth")
    If Target = .value Then
         Target.Copy: Range(".Offset(-8, 37).value, .Offset(-4, 37).value, .Offset(1, 37).value").PasteSpecial xlPasteFormulas 'error select range??
        Application.CutCopyMode = False
    End If
End With

End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Seeing as how you only want to paste to three separate ranges, why not simply use three lines?

Code:
    If Target = .value Then
         Target.Copy: .Offset(-8, 37).PasteSpecial xlPasteFormulas
[FONT=Verdana]              Target.Copy: [/FONT].Offset(-4, 37).PasteSpecial xlPasteFormulas
[FONT=Verdana]              Target.Copy: [/FONT].Offset(1, 37).PasteSpecial xlPasteFormulas
        Application.CutCopyMode = False
    End If
 
Upvote 0
I want copy target cell (i.e. Range("combin_oth')) to 3 cells only formula as follow:
Range("combin_oth").offset(-8,37).value
Range("combin_oth").offset(-4,37).value
Range("combin_oth").offset(1,37).value
 
Upvote 0
Seeing as how you only want to paste to three separate ranges, why not simply use three lines?

Code:
    If Target = .value Then
         Target.Copy: .Offset(-8, 37).PasteSpecial xlPasteFormulas
[FONT=Verdana]              Target.Copy: [/FONT].Offset(-4, 37).PasteSpecial xlPasteFormulas
[FONT=Verdana]              Target.Copy: [/FONT].Offset(1, 37).PasteSpecial xlPasteFormulas
        Application.CutCopyMode = False
    End If

Can I group in range?
 
Upvote 0
Code:
[COLOR=#333333]Target.Copy: Range(.Offset(-8, 37) & "," & .Offset(-4, 37) [/COLOR][COLOR=#333333]& "," &[/COLOR][COLOR=#333333] .Offset(1, 37)).PasteSpecial xlPasteFormulas[/COLOR]

This ought to do the trick. Tested and works with

Code:
Range(Cells(1, 1).Address(0, 0) & ", " & Cells(1, 3).Address(0, 0) & ", " & Cells(1, 5).Address(0, 0)).Select
 
Last edited:
Upvote 0
Code:
[COLOR=#333333]Target.Copy: Range(.Offset(-8, 37) & "," & .Offset(-4, 37) [/COLOR][COLOR=#333333]& "," &[/COLOR][COLOR=#333333] .Offset(1, 37)).PasteSpecial xlPasteFormulas[/COLOR]

This ought to do the trick. Tested and works with

Code:
Range(Cells(1, 1).Address(0, 0) & ", " & Cells(1, 3).Address(0, 0) & ", " & Cells(1, 5).Address(0, 0)).Select

Code1 Not work with error 1004 ['Range' method ('_Worksheet' obiect fail], I had add ActiveWorksheet.Range(..) but not work too.
Code2 I had considered but may be complexed with count cell?
 
Upvote 0
The second code was, as I mentioned, the code I tried my method on- and does not apply to your question.

Managed to make it work with:
Code:
Target.Copy
Range(.Offset(-8, 37).Address(0, 0) & "," & .Offset(-4, 37).Address(0, 0)  & "," & .Offset(1, 37).Address(0, 0)).PasteSpecial xlPasteFormulas
 
Upvote 0
Try using union:

Code:
Sub a1084949a()
With Range("A1")
Range("A2").Copy: Union(.Offset(0, 1), .Offset(0, 4), .Offset(0, 6)).PasteSpecial xlPasteFormulas
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

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