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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

venkat1926

Well-known Member
Joined
Aug 21, 2005
Messages
4,824
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
 

rjc4

Well-known Member
Joined
Nov 6, 2004
Messages
502
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
 

Forum statistics

Threads
1,136,650
Messages
5,677,000
Members
419,667
Latest member
MegEri

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
Top