Finding cells and values

M

Mike Fenton

I need to have a macro find a cell and copy it's contents
to a seperate worksheet in the same workbook. The
problem I am having is that the cells are not always in
the same cell number. They vary on location depending on
how much information is placed into a textbox that may
contain paragraphs or just one line. So basically, I
need it to find out where a column is and copy it. It
has to be a macro and I have to have it this way because
of backward compatability.
 
T

Tom Ogilvy

Dim rng as Range
set rng = worksheets("Sheet1").Find("abcd")
if not rng is nothing then
rng.copy
Destination:=worksheets("Sheet2").Cells(rows.count,1).End(xlup)(2)
End if
 
G

Guest

I need to have it find a cell, select that cell and a
range of cells along with it and then copy the
selection. That will only select one cell.
 
T

Tom Ogilvy

I need to have a macro find a cell and copy it's contents
to a seperate worksheet in the same workbook.

"find a cell:" sounds like a single cell.

Were not clairvoyant.

Dim rng as Range, numRows as Long, numColumns as Long
numRows = 3
numcolumns = 2
set rng = worksheets("Sheet1").Find("abcd")
if not rng is nothing then
rng.Resize(numRows,NumColumns).copy _
Destination:=worksheets("Sheet2") _
.Cells(rows.count,1).End (xlup)(2)
End if

If you want to do a lot of unnecessary selecting so you have really slow
code that flashes the screen all over the place to give the impression that
your a real amateur, post back.

Does that give you any ideas?
 
M

mike fenton

Yeah, that helps thanks for the advice. Now for you, A
bit of advice. Lighten up chief.
 
Top