Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default select only where text exists

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default select only where text exists

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default select only where text exists

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check if text exists within a cell range and return logical vaule - possible? [email protected] Excel Discussion (Misc queries) 2 July 20th 07 02:29 AM
Text file db where record already exists conundrum Greg Wilson Excel Programming 0 October 12th 06 10:47 PM
Text desappears when I select wrap text galse Excel Discussion (Misc queries) 4 June 2nd 06 09:28 PM
Checking a text box to make sure a code exists in our SQL Server Angelique Worrell Excel Programming 0 May 31st 06 07:47 PM
need array of true/false if text exists alex Excel Worksheet Functions 0 November 16th 04 09:58 AM


All times are GMT +1. The time now is 12:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"