Excel VBA: How to “offset” multiple ranges

modhorat

New Member
Joined
Mar 15, 2016
Messages
2
I'm looking to offset multiple ranges
Example:
[Ctrl + F] Using Find function, find all cells in Column A that = "XYZ" (Select All)
Then offset the active cells (all selected/found) 5 places to the right [.Offset(0,5)]
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Code:
Sub FDSet()

FindString = InputBox("Enter Text to Search For", "Search Text")

Dim ColARange As Range
Set ColARange = Range("A1:A100")
Dim Cell As Range

For Each Cell In ColARange
    If Cell.Value = FindString Then
        Cell.Offset(0, 5).Value = Cell.Value
    End If
    Next Cell

End Sub

Would something like this work?
 
Upvote 0
Re: Excel VBA: How to “offset” multiple ranges - [SOLVED]

Code:
Sub FDSet()

FindString = InputBox("Enter Text to Search For", "Search Text")

Dim ColARange As Range
Set ColARange = Range("A1:A100")
Dim Cell As Range

For Each Cell In ColARange
    If Cell.Value = FindString Then
        Cell.Offset(0, 5).Value = Cell.Value
    End If
    Next Cell

End Sub

Would something like this work?

Thanks a million, it works like a charm!!
 
Upvote 0

Forum statistics

Threads
1,226,730
Messages
6,192,702
Members
453,748
Latest member
akhtarf3

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