Macro help please

rjc4

Well-known Member
Joined
Nov 6, 2004
Messages
502
Hi All,
My data is in AS9:AT.....(xLUp)
ColumnAS contains a 2 letter code such as AA,AB,AC,AD,AE etc.
ColumnAT contains numbers beside the codes, such as 9, 15, 38, 7, 62.

I wish to select via an input box, a code or codes, say AA and AC, then
copy the data to BS30:BT.....

So in my example BS30:BT31 would contain AA 9 and AC 38 respectively.

Could anyone help with a macro to do this.
Thankyou.
RC
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
try this code with modifiction if necessary

Sub test()
Dim cfind As Range
Dim dest As Range
Dim code As String
Columns("AS:AT").Select
code = InputBox("type the code you require")
Set cfind = Selection.Find(code, lookat:=xlWhole)
MsgBox cfind.Address
Set dest = Range("BS30")
Range(cfind, cfind.Offset(0, 1)).Copy dest
End Sub
 
Upvote 0
Thanks for the input Venkat1926,
I'll have a play with your code and see what eventuates.
Cheers,
RC :biggrin:


try this code with modifiction if necessary

Sub test()
Dim cfind As Range
Dim dest As Range
Dim code As String
Columns("AS:AT").Select
code = InputBox("type the code you require")
Set cfind = Selection.Find(code, lookat:=xlWhole)
MsgBox cfind.Address
Set dest = Range("BS30")
Range(cfind, cfind.Offset(0, 1)).Copy dest
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,180
Members
448,871
Latest member
hengshankouniuniu

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