Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default Sync - Bob Phillips

Hey Bob you posted this code as a response to a question I
had yesterday. Thank you, it works however if the new
value added to A:A matches part of any other value in A:A
then it will not add the new value to B:B. For instance
lets say there are 100 values in A:A. One of the values
in A:A is "Randy Moore". Lets say I add a new value to
the list called "Ran". When I run the sync code it does
not add the new value "Ran" to B:B because "Ran" matches
part of one of the values already in A:A. How would this
be fixed?


Dim i As Long
Dim cLastB As Long
Dim oCell As Range

cLastB = Cells(Rows.Count, "B").End(xlUp).Row

On Error Resume Next
For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
Set oCell = Columns(2).Find(Cells(i, "A").Value)
If oCell Is Nothing Then
cLastB = cLastB + 1
Cells(cLastB, "B").Value = Cells(i, "A").Value
End If
Set oCell = Nothing
Next i

On Error GoTo 0


Thanks
Todd Huttenstine
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Sync - Bob Phillips

Todd,

Change this line

Set oCell = Columns(2).Find(Cells(i, "A").Value)

to

Set oCell = Columns(2).Find(Cells(i, "A").Value, lookat:=xlWhole)


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine" wrote in message
...
Hey Bob you posted this code as a response to a question I
had yesterday. Thank you, it works however if the new
value added to A:A matches part of any other value in A:A
then it will not add the new value to B:B. For instance
lets say there are 100 values in A:A. One of the values
in A:A is "Randy Moore". Lets say I add a new value to
the list called "Ran". When I run the sync code it does
not add the new value "Ran" to B:B because "Ran" matches
part of one of the values already in A:A. How would this
be fixed?


Dim i As Long
Dim cLastB As Long
Dim oCell As Range

cLastB = Cells(Rows.Count, "B").End(xlUp).Row

On Error Resume Next
For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
Set oCell = Columns(2).Find(Cells(i, "A").Value)
If oCell Is Nothing Then
cLastB = cLastB + 1
Cells(cLastB, "B").Value = Cells(i, "A").Value
End If
Set oCell = Nothing
Next i

On Error GoTo 0


Thanks
Todd Huttenstine



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default Sync - Bob Phillips

Oh thanks.



-----Original Message-----
Todd,

Change this line

Set oCell = Columns(2).Find(Cells(i, "A").Value)

to

Set oCell = Columns(2).Find(Cells(i, "A").Value,

lookat:=xlWhole)


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
Hey Bob you posted this code as a response to a

question I
had yesterday. Thank you, it works however if the new
value added to A:A matches part of any other value in

A:A
then it will not add the new value to B:B. For instance
lets say there are 100 values in A:A. One of the values
in A:A is "Randy Moore". Lets say I add a new value to
the list called "Ran". When I run the sync code it does
not add the new value "Ran" to B:B because "Ran" matches
part of one of the values already in A:A. How would

this
be fixed?


Dim i As Long
Dim cLastB As Long
Dim oCell As Range

cLastB = Cells(Rows.Count, "B").End(xlUp).Row

On Error Resume Next
For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
Set oCell = Columns(2).Find(Cells(i, "A").Value)
If oCell Is Nothing Then
cLastB = cLastB + 1
Cells(cLastB, "B").Value = Cells

(i, "A").Value
End If
Set oCell = Nothing
Next i

On Error GoTo 0


Thanks
Todd Huttenstine



.

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
to Bob Phillips Jack Sons Excel Discussion (Misc queries) 15 August 28th 07 02:51 PM
For Bob Phillips D.J.Shaw Excel Worksheet Functions 5 August 3rd 05 01:20 AM
Sync Code Todd Huttenstine Excel Programming 2 April 14th 04 08:53 PM
Bob Phillips boblauder[_2_] Excel Programming 2 January 21st 04 03:28 PM
ProgressBar Out of Sync RDallas Excel Programming 2 January 13th 04 04:25 PM


All times are GMT +1. The time now is 03:04 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"