Copying portions of data

  • Thread starter Thread starter Wendy Clarkson
  • Start date Start date
W

Wendy Clarkson

Is it possible to select a specific area of the worksheet using a find
command (the data changes every day) and copy just that portion onto a new
worksheet?

Thanks

Wendy
 
Hi Wendy,

If a verbal rule (or rules) can be devised to locate the area, then it is
very likely that someone could aaist you with code to automate this.
 
I agree with Norman, but this may get you started:

Option Explicit
Sub testme03()
Dim FoundCell As Range
Dim DestCell As Range
Dim WhatToFind As String

WhatToFind = InputBox(Prompt:="What to find?")

If Trim(WhatToFind) = "" Then
Exit Sub
End If
With ActiveSheet.UsedRange
Set FoundCell = .Find(What:=WhatToFind, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
Lookat:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
End With

If FoundCell Is Nothing Then
MsgBox "Not Found!"
Else
Set DestCell = Worksheets("sheet2").Range("a1")
FoundCell.Resize(12, 30).Copy _
Destination:=DestCell
End If
End Sub

But be careful.

You'll want to specify all the .find options (xlwhole v. xlpart, matchcase,
etc).

And this routine finds something and pastes it to A1 of sheet2.
And it copies 12 rows by 30 columns!
 

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

Back
Top