Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to write a macro that selects all the text in col A and B where data
exits. I dont want to copy the entire col A and B because i then have to paste that data to a spreadsheet appending it to the existing data. Spreadsheet 1 may have 1-100 + or - rows in it. It will vary. I then want to add it to the bottom of a master spreadsheet. I am using this spreadsheet somewhere else as a VLOOKUP. Any help on copy and pasteing the data would be appreciated! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's one way. Use the "specialcells" option to select cells that
contain text in cols A & B, for example Set rngcolA = Activesheet.usedrange.columns(1) Set rngColB = Activesheet.usedrange.columns(2) With rngcolA.specialcells(clcelltypeconstants) ..copy destination:="your new sheet" End with With rngcolB.specialcells(clcelltypeconstants) ..copy destination:="your new sheet" End with (note: untested code) This will limit the operation to the text cells in the "dirty" area of the worksheet, making your macro run much faster. HTH, JP On Nov 19, 6:27 pm, Daniel M wrote: I need to write a macro that selects all the text in col A and B where data exits. I dont want to copy the entire col A and B because i then have to paste that data to a spreadsheet appending it to the existing data. Spreadsheet 1 may have 1-100 + or - rows in it. It will vary. I then want to add it to the bottom of a master spreadsheet. I am using this spreadsheet somewhere else as a VLOOKUP. Any help on copy and pasteing the data would be appreciated! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Of course that should have been "xl" not "cl"
--JP On Nov 19, 6:44 pm, JP wrote: Here's one way. Use the "specialcells" option to select cells that contain text in cols A & B, for example Set rngcolA = Activesheet.usedrange.columns(1) Set rngColB = Activesheet.usedrange.columns(2) With rngcolA.specialcells(clcelltypeconstants) .copy destination:="your new sheet" End with With rngcolB.specialcells(clcelltypeconstants) .copy destination:="your new sheet" End with (note: untested code) This will limit the operation to the text cells in the "dirty" area of the worksheet, making your macro run much faster. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Check if text exists within a cell range and return logical vaule - possible? | Excel Discussion (Misc queries) | |||
Text file db where record already exists conundrum | Excel Programming | |||
Text desappears when I select wrap text | Excel Discussion (Misc queries) | |||
Checking a text box to make sure a code exists in our SQL Server | Excel Programming | |||
need array of true/false if text exists | Excel Worksheet Functions |