LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default While ... Wend

I greet all

I have problem.

I would like that my code acted as follows:

If user wrote some Text (but only in the odd columns) and if this Text is
incorrect with conditions, display MsgBox and written text becomes
deleted.... but my loop acted to many times....

where is mistake?

Pozdrawiam,

Andrzej



Private Sub Worksheet_Change(ByVal Target As Range)

Dim x As String
Dim k As Integer

x = Target.Value
k = 1
' blokada wpisu niewłaściwej nazwy cechy do zakładki
While k < 254
If Not Application.Intersect(Columns(k), Target) Is Nothing Then

If x <= "NGD" Or x = "NGN" Then
MsgBox " Incorrect data !!! " & Chr(10) & _
Chr(10) & " Try again "
Target.Value = ""
End If
End If

k = k + 2
Wend

End Sub


 
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
WEND in VBA Dave F Excel Discussion (Misc queries) 9 April 4th 23 10:37 AM


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