Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 84
Default How to determine if a cell has a value, then copy it to a new loca

Hello,

I need to determine if a cell in one worksheet has a specific string of
characters, and if yes, copy the entire cell to a second worksheet.

So,

If 'Worksheet1!a1' contains the string "ACS", copy the content of
'Worksheet1!a1' to 'Worksheet2!a1'

I've tried several things I've found on this BB, but not luck so far.

THANKS!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,574
Default How to determine if a cell has a value, then copy it to a new loca

=IF(NOT(ISERROR(SEARCH("ACS",'Worksheet1!a1'))),'W orksheet1!a1',"") ???

Dave
--
Brevity is the soul of wit.


"Shelly" wrote:

Hello,

I need to determine if a cell in one worksheet has a specific string of
characters, and if yes, copy the entire cell to a second worksheet.

So,

If 'Worksheet1!a1' contains the string "ACS", copy the content of
'Worksheet1!a1' to 'Worksheet2!a1'

I've tried several things I've found on this BB, but not luck so far.

THANKS!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default How to determine if a cell has a value, then copy it to a new loca

Try this small macro:

Sub shelley()
Set r1 = Sheets("Sheet1").Range("A1")
Set r2 = Sheets("Sheet2").Range("A1")
v = r1.Value
If InStr(v, "ACS") 0 Then
r1.Copy r2
End If
End Sub

If you are unfamiliar with VBA, See:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary's Student
gsnu200702


"Shelly" wrote:

Hello,

I need to determine if a cell in one worksheet has a specific string of
characters, and if yes, copy the entire cell to a second worksheet.

So,

If 'Worksheet1!a1' contains the string "ACS", copy the content of
'Worksheet1!a1' to 'Worksheet2!a1'

I've tried several things I've found on this BB, but not luck so far.

THANKS!

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default How to determine if a cell has a value, then copy it to a new loca

Formulas retrieve values--not really copy.

=if(countif('sheet1'!a1,"*acs*")0,'sheet1'!a1,"wh ateveryouwanthere")



Shelly wrote:

Hello,

I need to determine if a cell in one worksheet has a specific string of
characters, and if yes, copy the entire cell to a second worksheet.

So,

If 'Worksheet1!a1' contains the string "ACS", copy the content of
'Worksheet1!a1' to 'Worksheet2!a1'

I've tried several things I've found on this BB, but not luck so far.

THANKS!


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default How to determine if a cell has a value, then copy it to a new loca

Watch your apostrophes:

=IF(NOT(ISERROR(SEARCH("ACS",'Worksheet1'!a1))),'W orksheet1'!a1,"")

And sometimes just using =isnumber() makes the formula easier to read:

=IF(ISnumber(SEARCH("ACS",'Worksheet1'!a1)),'Works heet1'!a1,"")




Dave F wrote:

=IF(NOT(ISERROR(SEARCH("ACS",'Worksheet1!a1'))),'W orksheet1!a1',"") ???

Dave
--
Brevity is the soul of wit.

"Shelly" wrote:

Hello,

I need to determine if a cell in one worksheet has a specific string of
characters, and if yes, copy the entire cell to a second worksheet.

So,

If 'Worksheet1!a1' contains the string "ACS", copy the content of
'Worksheet1!a1' to 'Worksheet2!a1'

I've tried several things I've found on this BB, but not luck so far.

THANKS!


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 84
Default How to determine if a cell has a value, then copy it to a new

Thanks for the quick replies... I've tried the macro and ISERROR, but now I
see the need is more comlicated.

The range that I am searching is C33 through C77 (in Worksheet1)
If any of these cells contain the string "ACS"
I need the value of that cell to also be put into a cell in the 2nd worksheet
but the range for this is only A8 through A20

So the "target" isn't the same cell as the "source".

At no time will the source list (C33 - C77) return more values than will fit
in the target list (A8 - A20).

Much Thanks!
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,574
Default How to determine if a cell has a value, then copy it to a new

Good points, all. Agreed about ISNUMBER().

Dave
--
Brevity is the soul of wit.


"Dave Peterson" wrote:

Watch your apostrophes:

=IF(NOT(ISERROR(SEARCH("ACS",'Worksheet1'!a1))),'W orksheet1'!a1,"")

And sometimes just using =isnumber() makes the formula easier to read:

=IF(ISnumber(SEARCH("ACS",'Worksheet1'!a1)),'Works heet1'!a1,"")




Dave F wrote:

=IF(NOT(ISERROR(SEARCH("ACS",'Worksheet1!a1'))),'W orksheet1!a1',"") ???

Dave
--
Brevity is the soul of wit.

"Shelly" wrote:

Hello,

I need to determine if a cell in one worksheet has a specific string of
characters, and if yes, copy the entire cell to a second worksheet.

So,

If 'Worksheet1!a1' contains the string "ACS", copy the content of
'Worksheet1!a1' to 'Worksheet2!a1'

I've tried several things I've found on this BB, but not luck so far.

THANKS!


--

Dave Peterson

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default How to determine if a cell has a value, then copy it to a new

I'd apply data|Filter|autofilter and filter C33:C77 to show the cells that
contain ACS and then copy those visible rows to that other range.

Shelly wrote:

Thanks for the quick replies... I've tried the macro and ISERROR, but now I
see the need is more comlicated.

The range that I am searching is C33 through C77 (in Worksheet1)
If any of these cells contain the string "ACS"
I need the value of that cell to also be put into a cell in the 2nd worksheet
but the range for this is only A8 through A20

So the "target" isn't the same cell as the "source".

At no time will the source list (C33 - C77) return more values than will fit
in the target list (A8 - A20).

Much Thanks!


--

Dave Peterson
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
Copy Cell to Word ? Jakobshavn Isbrae Excel Discussion (Misc queries) 0 December 2nd 06 01:00 PM
AUTOMATIC way to copy the value of a cell in one spreadsheet Mihalis4 Excel Worksheet Functions 2 December 2nd 05 06:49 PM
How to Copy the value of a cell to any given cell Memphis Excel Discussion (Misc queries) 4 October 21st 05 08:29 PM
how to count the number of text frequencies and copy to other cell DG Excel Worksheet Functions 1 October 6th 05 07:11 PM
hpw do I logic test a cell then copy the row to diff. SS Debi Excel Worksheet Functions 4 October 5th 05 09:42 PM


All times are GMT +1. The time now is 01:13 PM.

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

About Us

"It's about Microsoft Excel"