ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to find range of cells (https://www.excelbanter.com/excel-programming/423546-macro-find-range-cells.html)

Mary

Macro to find range of cells
 
I'm new to Excel macros and need to copy the entire rows for the range from
the first through the last occurrence of "vacation" in column A. The number
of rows will vary each month. Then I need to paste those rows onto Sheet1 in
cell A1.

I've tried using the macro recorder but not getting anywhere. Can you help?

Thanks, Mary

Bernard Liengme

Macro to find range of cells
 
Please tell us in more detail how the layout of the data
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Mary" wrote in message
...
I'm new to Excel macros and need to copy the entire rows for the range
from
the first through the last occurrence of "vacation" in column A. The
number
of rows will vary each month. Then I need to paste those rows onto Sheet1
in
cell A1.

I've tried using the macro recorder but not getting anywhere. Can you
help?

Thanks, Mary




Mary

Macro to find range of cells
 
There are several columns of data separated by function. I want to find and
copy only the rows that have "vacation" in column A to a new worksheet. I
have a macro that sorts the workbook, so all rows are together. The first
and last row for the rows that have the vacation information will vary each
month when the report comes out.

"Bernard Liengme" wrote:

Please tell us in more detail how the layout of the data
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Mary" wrote in message
...
I'm new to Excel macros and need to copy the entire rows for the range
from
the first through the last occurrence of "vacation" in column A. The
number
of rows will vary each month. Then I need to paste those rows onto Sheet1
in
cell A1.

I've tried using the macro recorder but not getting anywhere. Can you
help?

Thanks, Mary





Don Guillett

Macro to find range of cells
 

Have a look at
datafilterautofilterfilter copy/paste. Record
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mary" wrote in message
...
I'm new to Excel macros and need to copy the entire rows for the range
from
the first through the last occurrence of "vacation" in column A. The
number
of rows will vary each month. Then I need to paste those rows onto Sheet1
in
cell A1.

I've tried using the macro recorder but not getting anywhere. Can you
help?

Thanks, Mary



Mary

Macro to find range of cells
 
Thanks, that helped. I didn't see all of the options you mentioned in Office
2007, but was able to use autofilter in the macro recorder and it works great.

Here's my code:

Sub vac_filter()
Selection.AutoFilter
ActiveSheet.Range("$A$1:$P$65536").AutoFilter Field:=1,
Criteria1:="vacation"
Cells.Select
Sheets("Exec Dir Details").Select
Sheets("Exec Dir Details").Copy After:=Sheets(3)
Range("A1").Select
End Sub

"Don Guillett" wrote:


Have a look at
datafilterautofilterfilter copy/paste. Record
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mary" wrote in message
...
I'm new to Excel macros and need to copy the entire rows for the range
from
the first through the last occurrence of "vacation" in column A. The
number
of rows will vary each month. Then I need to paste those rows onto Sheet1
in
cell A1.

I've tried using the macro recorder but not getting anywhere. Can you
help?

Thanks, Mary





All times are GMT +1. The time now is 05:21 PM.

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