LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Find string from column A in Range("B2:F7") list the header of that column/s


From the list of items in column A, find each (if they exist) in Range("B2:F7") and list the header of that column (B1:F1) in column J. Column A items can occur under multiple headers in B1 to F1.

I'm sure this is the culprit line...

..Range("J100").End(xlUp).Offset(1, 0) = i.Offset(Cells.End(xlUp), 0).Value

Secondly, in column J where the header is listed, I am struggling to get the cell address of "i" next to header name in column K.

So an example would be in col J = Col_B_Header and in col K = $B$5

Regards,
Howard

Option Explicit

Sub ListHeader()

Dim lngLstRow As Long
Dim rngA As Range, i As Range

With Sheets("Sheet2")
lngLstRow = .UsedRange.Rows.Count
For Each rngA In .Range("A2:A" & lngLstRow)
For Each i In Range("B2:F7")
If i.Value = rngA Then
.Range("J100").End(xlUp).Offset(1, 0) _
= i.Offset(Cells.End(xlUp), 0).Value
End If
Next
Next
End With

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro is to update column 13 and 14 of worksheet "Voice BB Pending"as per column 2 and 3 of "Activity log" . San[_3_] Excel Programming 1 August 19th 10 11:19 AM
find "Cancellation" in column "A" and copy all data from Columns B-F onto another Sheet bjohnson Excel Programming 1 September 20th 07 04:02 PM
how can I count if column A="active" and column E="Job" in a list? Brandoni Excel Worksheet Functions 1 October 14th 06 09:09 AM
Copying by Column "Header Name" macro akane Excel Programming 3 July 7th 06 09:07 PM


All times are GMT +1. The time now is 01:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"