Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 493
Default Visual Basic Question

I have used some formulas in Visual Basic which have worked very well, but I
have come across a small, but still irritating problem.

I have a column M which has different statuses (Offer Accepted, Offer
Declined, Offer Outstanding, 1st Round Offer, 2nd Round Offer, Assessment
Centre), I created the following formula in Visual Basic

TryD:

If Intersect(Target, Range("$M$10:$M$209")) Is Nothing Then GoTo TryE
For Each myCell In Intersect(Target, Range("$M$10:$M$209"))
If myCell.Value < "Offer" Then
Application.EnableEvents = False
myCell.Offset(0, 1).ClearContents
Application.EnableEvents = True
End If
Next myCell

What happens is if I change the status from Offer Declined to Offer Accepted
in column M, it removes everything in column N, when I only want that to
happen when M does not contain "offer" or is blank.
Is there anyway of doing this?


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 329
Default Visual Basic Question

Hi Alex,

Instead of:
If myCell.Value < "Offer" Then
try:
If InStr(myCell.Value, "Offer") = 0 Then

Cheers

--
macropod
[MVP - Microsoft Word]


"Alex" wrote in message ...
| I have used some formulas in Visual Basic which have worked very well, but I
| have come across a small, but still irritating problem.
|
| I have a column M which has different statuses (Offer Accepted, Offer
| Declined, Offer Outstanding, 1st Round Offer, 2nd Round Offer, Assessment
| Centre), I created the following formula in Visual Basic
|
| TryD:
|
| If Intersect(Target, Range("$M$10:$M$209")) Is Nothing Then GoTo TryE
| For Each myCell In Intersect(Target, Range("$M$10:$M$209"))
| If myCell.Value < "Offer" Then
| Application.EnableEvents = False
| myCell.Offset(0, 1).ClearContents
| Application.EnableEvents = True
| End If
| Next myCell
|
| What happens is if I change the status from Offer Declined to Offer Accepted
| in column M, it removes everything in column N, when I only want that to
| happen when M does not contain "offer" or is blank.
| Is there anyway of doing this?
|
|


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 493
Default Visual Basic Question

Excellent, thanks for that.

"macropod" wrote:

Hi Alex,

Instead of:
If myCell.Value < "Offer" Then
try:
If InStr(myCell.Value, "Offer") = 0 Then

Cheers

--
macropod
[MVP - Microsoft Word]


"Alex" wrote in message ...
| I have used some formulas in Visual Basic which have worked very well, but I
| have come across a small, but still irritating problem.
|
| I have a column M which has different statuses (Offer Accepted, Offer
| Declined, Offer Outstanding, 1st Round Offer, 2nd Round Offer, Assessment
| Centre), I created the following formula in Visual Basic
|
| TryD:
|
| If Intersect(Target, Range("$M$10:$M$209")) Is Nothing Then GoTo TryE
| For Each myCell In Intersect(Target, Range("$M$10:$M$209"))
| If myCell.Value < "Offer" Then
| Application.EnableEvents = False
| myCell.Offset(0, 1).ClearContents
| Application.EnableEvents = True
| End If
| Next myCell
|
| What happens is if I change the status from Offer Declined to Offer Accepted
| in column M, it removes everything in column N, when I only want that to
| happen when M does not contain "offer" or is blank.
| Is there anyway of doing this?
|
|



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Visual Basic Question

You could also use

If Not myCell.Value Like "Offer*" Then

--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"macropod" wrote in message
...
Hi Alex,

Instead of:
If myCell.Value < "Offer" Then
try:
If InStr(myCell.Value, "Offer") = 0 Then

Cheers

--
macropod
[MVP - Microsoft Word]


"Alex" wrote in message

...
| I have used some formulas in Visual Basic which have worked very well,

but I
| have come across a small, but still irritating problem.
|
| I have a column M which has different statuses (Offer Accepted, Offer
| Declined, Offer Outstanding, 1st Round Offer, 2nd Round Offer,

Assessment
| Centre), I created the following formula in Visual Basic
|
| TryD:
|
| If Intersect(Target, Range("$M$10:$M$209")) Is Nothing Then GoTo TryE
| For Each myCell In Intersect(Target, Range("$M$10:$M$209"))
| If myCell.Value < "Offer" Then
| Application.EnableEvents = False
| myCell.Offset(0, 1).ClearContents
| Application.EnableEvents = True
| End If
| Next myCell
|
| What happens is if I change the status from Offer Declined to Offer

Accepted
| in column M, it removes everything in column N, when I only want that to
| happen when M does not contain "offer" or is blank.
| Is there anyway of doing this?
|
|




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
Micrsoft Visual Basic Compile error: Expected: end of statement IJ Excel Discussion (Misc queries) 5 October 23rd 06 12:08 AM
Visual basic editor Answerfactory Excel Discussion (Misc queries) 3 October 9th 06 09:13 PM
Macro Calling Visual Basic References phauenstein Excel Discussion (Misc queries) 1 August 24th 05 09:28 PM
Visual Basic and VBA Forum Throne Software Excel Discussion (Misc queries) 0 July 9th 05 04:21 AM
basic pie chart question KayR Charts and Charting in Excel 4 January 23rd 05 08:16 PM


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