Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Why it doesn't work

Hi,

Why this code stop always at the last not empty line (7269). The data is at
line 6839. Any tought.

Dim Line As Integer

For u = 2 To .Range("A65536").End(xlUp).Row
If .Cells(u, 1) = Me.Combo1.Text And .Cells(u, 2) = Me.Combo2.Text And
..Cells(u, 3) = Me.Combo3.Text And .Cells(u, 4) = Me.Combo4.Text Then
Line = u
Exit Sub
End If
Next

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Why it doesn't work

Maybe there's a difference between what's in the comboboxes and what's in those
cells--upper/lower case differences, spelling differences, differences in
spaces????

"François" wrote:

Hi,

Why this code stop always at the last not empty line (7269). The data is at
line 6839. Any tought.

Dim Line As Integer

For u = 2 To .Range("A65536").End(xlUp).Row
If .Cells(u, 1) = Me.Combo1.Text And .Cells(u, 2) = Me.Combo2.Text And
.Cells(u, 3) = Me.Combo3.Text And .Cells(u, 4) = Me.Combo4.Text Then
Line = u
Exit Sub
End If
Next

Thanks


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Why it doesn't work

Add some debug.print lines to verify--I bet there's a difference.

debug.print .cells(u,1).value & vblf & me.combo1.text

then look for the differences in the immediate window.



"François" wrote:

No differences, the datas in the comboboxes are the same than de cells.

Thanks for you help.

"Dave Peterson" a écrit dans le message de news:
...
Maybe there's a difference between what's in the comboboxes and what's in
those
cells--upper/lower case differences, spelling differences, differences in
spaces????

"François" wrote:

Hi,

Why this code stop always at the last not empty line (7269). The data is
at
line 6839. Any tought.

Dim Line As Integer

For u = 2 To .Range("A65536").End(xlUp).Row
If .Cells(u, 1) = Me.Combo1.Text And .Cells(u, 2) = Me.Combo2.Text And
.Cells(u, 3) = Me.Combo3.Text And .Cells(u, 4) = Me.Combo4.Text Then
Line = u
Exit Sub
End If
Next

Thanks


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Why it doesn't work

Here what I have :

Private Sub CmdOK_Click()
Dim Line As Integer
Dim u As Integer

With Sheets("Inventory")

For u = 2 To .Range("A65536").End(xlUp).Row
If .Cells(u, 1) = Me.Combo1.Text Then
Debug.Print .Cells(u, 1).Value & vbLf & Me.Combo1.Text 'u =7414, Combo1
= w
If .Cells(u, 2) = Me.Combo2.Text Then
Debug.Print .Cells(u, 1).Value & vbLf & Me.Combo1.Text 'u =7414, Combo2
= x
If .Cells(u, 3) = Me.Combo3.Text Then
Debug.Print .Cells(u, 1).Value & vbLf & Me.Combo1.Text 'u =7414, Combo3
= y
If .Cells(u, 4) = Me.Combo4.Text Then
Debug.Print .Cells(u, 1).Value & vbLf & Me.Combo1.Text 'u =7414, Combo4
= z
Line = u
Exit Sub
End If
End If
End If
End If
Next

"Dave Peterson" a écrit dans le message de news:
...
Add some debug.print lines to verify--I bet there's a difference.

debug.print .cells(u,1).value & vblf & me.combo1.text

then look for the differences in the immediate window.



"François" wrote:

No differences, the datas in the comboboxes are the same than de cells.

Thanks for you help.

"Dave Peterson" a écrit dans le message de
news:
...
Maybe there's a difference between what's in the comboboxes and what's
in
those
cells--upper/lower case differences, spelling differences, differences
in
spaces????

"François" wrote:

Hi,

Why this code stop always at the last not empty line (7269). The data
is
at
line 6839. Any tought.

Dim Line As Integer

For u = 2 To .Range("A65536").End(xlUp).Row
If .Cells(u, 1) = Me.Combo1.Text And .Cells(u, 2) = Me.Combo2.Text And
.Cells(u, 3) = Me.Combo3.Text And .Cells(u, 4) = Me.Combo4.Text Then
Line = u
Exit Sub
End If
Next

Thanks

--

Dave Peterson


--

Dave Peterson





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Why it doesn't work

I think I would have used all the fields:

for u = 2 to ....
Debug.print "==========" & u & "===="
Debug.Print "1: " & .Cells(u, 1).Value & "|" & Me.Combo1.Text
Debug.Print "2: " & .Cells(u, 2).Value & "|" & Me.Combo2.Text
Debug.Print "3: " & .Cells(u, 3).Value & "|" & Me.Combo3.Text
Debug.Print "4: " & .Cells(u, 4).Value & "|" & Me.Combo4.Text
Debug.Print "=============="
'and comment out the other stuff
next u

And if you know a row that is exactly the same start the

for u = 2342 to 2345 'say


"François" wrote:

Here what I have :

Private Sub CmdOK_Click()
Dim Line As Integer
Dim u As Integer

With Sheets("Inventory")

For u = 2 To .Range("A65536").End(xlUp).Row
If .Cells(u, 1) = Me.Combo1.Text Then
Debug.Print .Cells(u, 1).Value & vbLf & Me.Combo1.Text 'u =7414, Combo1
= w
If .Cells(u, 2) = Me.Combo2.Text Then
Debug.Print .Cells(u, 1).Value & vbLf & Me.Combo1.Text 'u =7414, Combo2
= x
If .Cells(u, 3) = Me.Combo3.Text Then
Debug.Print .Cells(u, 1).Value & vbLf & Me.Combo1.Text 'u =7414, Combo3
= y
If .Cells(u, 4) = Me.Combo4.Text Then
Debug.Print .Cells(u, 1).Value & vbLf & Me.Combo1.Text 'u =7414, Combo4
= z
Line = u
Exit Sub
End If
End If
End If
End If
Next

"Dave Peterson" a écrit dans le message de news:
...
Add some debug.print lines to verify--I bet there's a difference.

debug.print .cells(u,1).value & vblf & me.combo1.text

then look for the differences in the immediate window.



"François" wrote:

No differences, the datas in the comboboxes are the same than de cells.

Thanks for you help.

"Dave Peterson" a écrit dans le message de
news:
...
Maybe there's a difference between what's in the comboboxes and what's
in
those
cells--upper/lower case differences, spelling differences, differences
in
spaces????

"François" wrote:

Hi,

Why this code stop always at the last not empty line (7269). The data
is
at
line 6839. Any tought.

Dim Line As Integer

For u = 2 To .Range("A65536").End(xlUp).Row
If .Cells(u, 1) = Me.Combo1.Text And .Cells(u, 2) = Me.Combo2.Text And
.Cells(u, 3) = Me.Combo3.Text And .Cells(u, 4) = Me.Combo4.Text Then
Line = u
Exit Sub
End If
Next

Thanks

--

Dave Peterson


--

Dave Peterson


--

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
Macro to update a column in a work based on another work sheet WickerMan New Users to Excel 1 December 4th 09 12:58 PM
how can i automatically generate work order numbers from work orde rob h Excel Discussion (Misc queries) 1 July 13th 09 07:59 PM
If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct? Marc Excel Programming 2 July 12th 06 04:10 AM
Counting dates in multiple work sheets and work books Savage Excel Discussion (Misc queries) 0 December 19th 05 11:41 PM
Is there away to keep "auto save" from jumping to the first work sheet in the work book? Marc New Users to Excel 2 April 21st 05 01:27 AM


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