Return Value if Not Blank

laxjuan05

New Member
Joined
Jan 3, 2017
Messages
21
Hello,

I have a range where it displays if sections are being used or not. I need to display which sections are used in one column if possible.

For example Total Column row 1 would need to display 4,6,9,10
Total Column row 2 would need to display 5,7
Total Column row 3 would display 8

Is this Possible?
Thanks

4
5
6
7
8
9
10
Total
x
x
x
x
4,6,9,10
x
x
5,7
x
8

<tbody>
</tbody>
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Try:
Code:
Sub ReturnValue()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim x As Long
    Dim rng As Range
    For x = 2 To LastRow
        For Each rng In Range("A" & x & ":G" & x)
            If rng <> "" Then
                Range("H" & x) = Range("H" & x) & ", " & Cells(1, rng.Column)
            End If
        Next rng
        Range("H" & x) = Mid(Range("H" & x), 3, 999)
    Next x
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,235
Messages
6,129,650
Members
449,524
Latest member
RAmraj R

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