selecting a range

J

john.9.williams

i have a program that scrools across column headers that are in row
10. when it finds the header that = the variable thats already been
gained from a list box i want the code to stop moving across and
select the current column and the next five columns along and also the
below 15 rows. once selected i am trying to copy it somewhere else.

Just cannot seem to get the data selected

any help greatly recieved

John
 
X

XR8 Sprintless

i have a program that scrools across column headers that are in row
10. when it finds the header that = the variable thats already been
gained from a list box i want the code to stop moving across and
select the current column and the next five columns along and also the
below 15 rows. once selected i am trying to copy it somewhere else.

Just cannot seem to get the data selected

any help greatly recieved

John

Range("A10").EntireRow.Select
Selection.Find(What:="" & dname & "", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

Range(ActiveCell, ActiveCell.Offset(15, 5)).Select
Selection.Copy


Replace dname with the variable name you are getting from the list
boxand the rest should then allow you to copy it and paste it elsewhere.
Hopefully this will work for you.
 
D

Don Guillett

i have a program that scrools across column headers that are in row
10. when it finds the header that = the variable thats already been
gained from a list box i want the code to stop moving across and
select the current column and the next five columns along and also the
below 15 rows. once selected i am trying to copy it somewhere else.

Just cannot seem to get the data selected

any help greatly recieved

John


Sub findtextinrow10andselectrangeSAS()
Set mf = Rows(10).Find(What:="yourtexthere", _
LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByColumns, SearchDirection:=xlNext)

If Not mf Is Nothing Then mf.Resize(16, 6).copy range("h10")
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top