LOOKUP & Select Row

DetroitDavid

Board Regular
Joined
Jul 20, 2013
Messages
211
I’d like to select an entire row (or to the limit of a range) as show below in light blue, when a value (which is text) is supplied via an input.

Something like:

GetAgencyNumber = InputBox("Agency Number")
Application.Goto (ActiveWorkbook.Sheets("Header").Range("B1"))
Set cell = Selection.Find(GetAgencyNumber, ActiveCell)
Copy the range A2:M2 ‘’’ (this would change depending on the input value)


Header

*ABCDEFGHIJKLM
header-typeprovider-idsample-yearsurvey-modesample-type

<colgroup><col style="width: 30px; font-weight: bold;"><col style="width: 83px;"><col style="width: 103px;"><col style="width: 190px;"><col style="width: 68px;"><col style="width: 87px;"><col style="width: 49px;"><col style="width: 85px;"><col style="width: 88px;"><col style="width: 84px;"><col style="width: 137px;"><col style="width: 95px;"><col style="width: 64px;"><col style="width: 64px;"></colgroup><tbody>
[TD="bgcolor: #CACACA, align: center"]1[/TD]

[TD="align: left"]client_number[/TD]
[TD="align: left"]provider-name[/TD]

[TD="align: center"]npi[/TD]
[TD="align: left"]sample-month[/TD]

[TD="align: center"]total patients served[/TD]
[TD="align: center"]number-vendor-submitted[/TD]
[TD="align: center"]TEP[/TD]
[TD="align: center"]number-surveyed[/TD]

[TD="bgcolor: #CACACA, align: center"]2[/TD]
[TD="bgcolor: #99CCFF, align: right"]1[/TD]
[TD="bgcolor: #339966, align: center"]001[/TD]
[TD="bgcolor: #99CCFF"]Client 1[/TD]
[TD="bgcolor: #99CCFF, align: right"]237492[/TD]
[TD="bgcolor: #99CCFF, align: center"]1679515068[/TD]
[TD="bgcolor: #99CCFF, align: left"]4[/TD]
[TD="bgcolor: #99CCFF, align: right"]2013[/TD]
[TD="bgcolor: #99CCFF, align: right"]1[/TD]
[TD="bgcolor: #99CCFF, align: right"]1[/TD]
[TD="bgcolor: #99CCFF, align: center"]8[/TD]
[TD="bgcolor: #99CCFF, align: center"]8[/TD]
[TD="bgcolor: #99CCFF, align: center"]5[/TD]
[TD="bgcolor: #99CCFF, align: center"]4[/TD]

</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Last edited:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi,

As per your request i assume you have to search in B Column hence it will select in B Column and find the input number and select the entire row.


GetAgencyNumber = InputBox("Agency Number")
Application.Goto (ActiveWorkbook.Sheets("Header").Range("B1"))
Columns("b:b").Select
Selection.Find(what:=GetAgencyNumber, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
ActiveCell.EntireRow.Select

Thanks,
SK
 
Upvote 0
Awesome – works perfectly & I'm learning a lot! Now I need to take it another level. After getting the above (which is to be an XML header from the Header tab, I need to move to the Data tab and grab the body portion to go with that header in a separate worksheet. So, using the same Agency Number from the input, I need to select a range (cols hidden to show entire range). In the case of “001” it would be B2:CE3. In the case of “002” it would be B4:CE7. Initial screen of tab “Date” 2nd screen of tab “XML WS” below it. Note, the 001 in col A of data does not get copied, and is only needed for sorting. The client value comes from =MID() the 3rd octet of the SID number. The "XML WS" gets saved to an XML document for each client. I'd eventually like to rip through 140+ non-sequential client numbers. Thank you so much!!!

Thoughts?

Excel Workbook
ABCDEFGBDBEBFBGBHBIBJBKBLBMBNBOBPBQBRBSBTBUBVBWBXBYBZCACBCCCDCE
1Do NOT copy col A - Select Bx:CeySID
2001237492167951506842013D-13-001-7543210MMMMMMMMMMMMMMMMMMMMMMMMM350M1
3001237492167951506842013D-13-001-7543314MMMMMMMMMMMMMMMMMMMMMMMMM350M1
4002237603127563054342013D-13-002-7874911MMMMMMMMMMMMMMMMMMMMMMMMM350M1
5002237603127563054342013D-13-002-7875014MMMMMMMMMMMMMMMMMMMMMMMMM350M1
6002237603127563054342013D-13-002-7875214MMMMMMMMMMMMMMMMMMMMMMMMM350M1
7002237603127563054342013D-13-002-7875311MMMMMMMMMMMMMMMMMMMMMMMMM350M1
Data



Excel Workbook
ABCDEF
1header-typenumberprovider-nameprovider-idnpisample-month
21001Client 123749216795150684
3provideridnpisample-monthsample-yrsample-idpatient-age
4237492167951506842013D-13-001-7543210
5237492167951506842013D-13-001-7543314
XML WS
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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