Return a value from specific array of row

purushothamhk693

New Member
Joined
Nov 21, 2014
Messages
2
HiI've a requirement, need to a return a value from an array of single row which fulfills the below condition:The formula or macro has to search for an entire selected range of a row and get the value of second cell from the first blank cell in the selected array of rows.Can anyone please help me?Thank you// Hk
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
If you select the rage to be only 1 column wide then you can use this function.
Code:
Function afterBlank(myRange)
    '= afterBlank(A1:A100)
    output = FALSE
    For Each item in Range
        If output = TRUE Then
            afterBlank = item
            Exit Function
        End If
        If item = "" Then
            output = TRUE
        End If
    Next item
End Function
 
Upvote 0
Hi HK,

Try this. With adjusted sheet names.

Regards,
Howard

Code:
Option Explicit

Sub MyOffsetPlus()
Dim c As Range
Dim lr As Long
Dim aRng As Range

lr = Cells(Rows.Count, 1).End(xlUp).Row
Set aRng = Range("A1:A" & lr)

For Each c In aRng

  If Cells(c.Row, 1).Offset(, 1) = "" Then
     Cells(c.Row, 1).Offset(, 3).Copy Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp)(2)
   Else
     Cells(c.Row, 1).End(xlToRight).Offset(, 3).Copy Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp)(2)
  End If

Next

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,273
Messages
6,123,984
Members
449,137
Latest member
abdahsankhan

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