Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default If cell contatin string like .... copy in Offset mode

Hi , and a good day everybody

Please to help me with this problem :

I have in a range (f or example : A1:E100 ),
in different cells , numbers like in the follow format /(string)
like :

12-16-18-25-33-43 ;

The other cell contain another values , like :
3 , - , etc .
I need a code to loop through my range cell
by cell , and , IF the value of cell is in string mode like :

17-28-34-36-39-42 ( can be different numbers , but with
the sign - beetwen them )

to copy them in another range , for example G1 ,
useing Offset function , like : Offset ( 1, 0) .

A lot of thanks in advance .
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default If cell contatin string like .... copy in Offset mode

Your question is not clear on whether you want to locate strings with
exactly 5 dashes in it (with numbers on each side of each dash) or whether
you want to locate strings containing any number of dashes (again, with
numbers on each side)... I assumed the latter. Give this code a try and see
if it does what you want...

Sub CopyDashedStrings()
Dim Cell As Range
For Each Cell In Range("A1:E100")
If Cell.Value Like "*#-#*" Then Cell.Offset(0, 6).Value = Cell.Value
Next
End Sub

--
Rick (MVP - Excel)



"ytayta555" wrote in message
...
Hi , and a good day everybody

Please to help me with this problem :

I have in a range (f or example : A1:E100 ),
in different cells , numbers like in the follow format /(string)
like :

12-16-18-25-33-43 ;

The other cell contain another values , like :
3 , - , etc .
I need a code to loop through my range cell
by cell , and , IF the value of cell is in string mode like :

17-28-34-36-39-42 ( can be different numbers , but with
the sign - beetwen them )

to copy them in another range , for example G1 ,
useing Offset function , like : Offset ( 1, 0) .

A lot of thanks in advance .


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default If cell contatin string like .... copy in Offset mode

On 23 apr., 20:14, "Rick Rothstein"
wrote:

I see that your code work in any situation .

This is the code that I was looking for , and it do
all what I need :

Sub CopyDashedStrings()

Dim Cell As Range
For Each Cell In Range("A1:E100")
If Cell.Value Like "*#-#*" Then ActiveCell.Offset(1, 0).Value =
Cell.Value
If ActiveCell.Offset(1, 0).Value Like "*#-#*" Then
ActiveCell.Offset(1, 0).Select
Next Cell

End Sub

Thank you so much , you are really great .

GOD BLESS MICROSOFT . AND ALL WHICH WORKED TO BUILT IT .
AND WHICH WORK IN IT .
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 (A2:A26) paste, offset one cell, do it again. Loop 256 tim RyGuy Excel Programming 4 October 22nd 09 08:25 PM
Repost: Copy and Offset cell reference CJ[_2_] Excel Worksheet Functions 1 September 5th 08 03:38 PM
Find String in Cell then Paste Sum in Offset Cell RyanH Excel Programming 1 January 23rd 08 02:06 AM
copy offset to cell Kev Excel Discussion (Misc queries) 6 December 31st 06 04:02 AM
Find, Copy offset to offset on other sheet, Run-time 1004. Finny[_3_] Excel Programming 10 December 7th 06 11:46 PM


All times are GMT +1. The time now is 10:18 AM.

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"