ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding cells and values (https://www.excelbanter.com/excel-programming/296340-finding-cells-values.html)

Mike Fenton[_2_]

Finding cells and values
 
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.

Tom Ogilvy

Finding cells and values
 
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

--
Regards,
Tom Ogilvy


"Mike Fenton" wrote in message
...
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.




No Name

Finding cells and values
 
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.
-----Original Message-----
Dim rng as Range
set rng = worksheets("Sheet1").Find("abcd")
if not rng is nothing then
rng.copy
Destination:=worksheets("Sheet2").Cells(rows.coun t,1).End

(xlup)(2)
End if

--
Regards,
Tom Ogilvy


"Mike Fenton"

wrote in message
...
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.



.


Tom Ogilvy

Finding cells and values
 
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?



--
Regards,
Tom Ogilvy


wrote in message
...
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.
-----Original Message-----
Dim rng as Range
set rng = worksheets("Sheet1").Find("abcd")
if not rng is nothing then
rng.copy
Destination:=worksheets("Sheet2").Cells(rows.coun t,1).End

(xlup)(2)
End if

--
Regards,
Tom Ogilvy


"Mike Fenton"

wrote in message
...
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.



.




mike fenton

Finding cells and values
 
Yeah, that helps thanks for the advice. Now for you, A
bit of advice. Lighten up chief.
-----Original Message-----
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?



--
Regards,
Tom Ogilvy


wrote in message
...
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.
-----Original Message-----
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

--
Regards,
Tom Ogilvy


"Mike Fenton"

wrote in message
...
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.


.



.



All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com