VBA - Find and Return Cell Range (Row)

Bablu

Board Regular
Joined
Dec 9, 2008
Messages
131
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

I been attempting to modify a code, below:

My issue is here:Qfooter = foundcell.Value, instead of the just the value, I would like to pick up the entire range.

Any help would be great. Thanks in advance!

Sub Find_And_Return_cell_value()
On Error Resume Next
For Each cll In Selection.SpecialCells(xlCellTypeVisible).Cells
Rfooter = Empty
datatoFind = cll.Value
If datatoFind <> "" Then
If Not IsError(CDbl(datatoFind)) Then datatoFind = CDbl(datatoFind)
For Each Sht In ActiveWorkbook.Sheets
If Not Sht Is ActiveSheet Then
Set foundcell = Sht.Cells.Find(what:=datatoFind, LookIn:=xlFormulas, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Not foundcell Is Nothing Then


Qfooter = foundcell.Value <----- Change to pick the entire range, not just the value

Cells(cll.Row, Columns.Count).End(xlToLeft).Offset(, 1) = Qfooter
Exit For
End If
End If
Next
End If
Next
End Sub

Thanks
Bablu
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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