Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() OK, Here is what I am trying to accomplish: I have a large worksheet I am working with and I am working on a macro to select certain cells that meet a specific criteria and copy and paste those cells only into another worksheet. I have the select and paste part down but how to I enable it to assign a condition? For example, I would like the macro to select all the cells that contain 99 in the front of the number of one column and copy those cells into another worksheet. Can someone please point me in the right direction? Thanks in advance. -Dave -- DSC174 ------------------------------------------------------------------------ DSC174's Profile: http://www.excelforum.com/member.php...o&userid=27553 View this thread: http://www.excelforum.com/showthread...hreadid=470759 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
for each cell in Range("B2:B50")
if left(cell.Value,2) = "99" then if rng is nothing then set rng = cell else set rng = union(rng,cell) end if end if Next if not rng is nothing then rng.copy Destination:=Worksheets("Sheet3").Range("A1") end if depending on the arrangement of the cells you select you may be able to do it with one copy command as shown, or you may have to loop through your "rng" and copy each area individually. -- Regards, Tom Ogilvy "DSC174" wrote in message ... OK, Here is what I am trying to accomplish: I have a large worksheet I am working with and I am working on a macro to select certain cells that meet a specific criteria and copy and paste those cells only into another worksheet. I have the select and paste part down but how to I enable it to assign a condition? For example, I would like the macro to select all the cells that contain 99 in the front of the number of one column and copy those cells into another worksheet. Can someone please point me in the right direction? Thanks in advance. -Dave -- DSC174 ------------------------------------------------------------------------ DSC174's Profile: http://www.excelforum.com/member.php...o&userid=27553 View this thread: http://www.excelforum.com/showthread...hreadid=470759 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to select cells without a certain value and select a menu it | Excel Worksheet Functions | |||
need a macro select all cells in a worksheet? | Excel Discussion (Misc queries) | |||
Want macro to select & copy cells from a different worksheet | Excel Discussion (Misc queries) | |||
How do I pause a macro to select specific cells | Excel Worksheet Functions | |||
how to select cells dynamically in excel macro? | Excel Programming |