+ Reply to Thread
Results 1 to 3 of 3

IF AND THEN issue

  1. #1
    Registered User
    Join Date
    08-17-2012
    Location
    Chicago, IL
    MS-Off Ver
    Office 365
    Posts
    35

    Question IF AND THEN issue

    Hello, I think I'm losing it in my old age. I'm having trouble creating the correct VBA syntax for this issue:

    If A2 contains (" - ")
    AND
    O2 IS BLANK
    THEN
    O2 = 0
    End if

    If that isn't clear, what I'm trying to do is if A2 contains a space-dash-space AND Cell O2 is blank,
    then replace Cell O2 with a Zero. Then I will need to run that down the column.

    Something in the back of my mind is telling me that the Excel formula to do this and the vba code to do this are not the same.

    Thanks for the help!

    P.S. I forgot to mention that if the value in O2 is some other number, I want to retain that number. Details, details, details.....
    Last edited by patb; 08-08-2022 at 09:49 AM. Reason: Additional information

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2405
    Posts
    25,069

    Re: IF AND THEN issue

    I would do this:
    Please Login or Register  to view this content.
    or maybe
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    08-17-2012
    Location
    Chicago, IL
    MS-Off Ver
    Office 365
    Posts
    35

    Red face Re: IF AND THEN issue

    PERFECT!!! Both of them work the same. And I did test it on a row that had a value already in Col O and it left it alone! It's a good Monday!

    Thanks,
    Pat

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel 2010 new Workbook not showing in VBA Project explorer
    By adamtzvi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-11-2020, 08:50 AM
  2. Listbox issue + Setfocus after property Issue
    By naveenmarapaka in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-27-2018, 09:42 PM
  3. Data Validation / VBA / Row Limit issue
    By notemore in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-24-2018, 08:55 AM
  4. Replies: 7
    Last Post: 12-15-2017, 12:14 AM
  5. [SOLVED] Insert shift down issue macro issue
    By CC64 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-15-2012, 10:57 PM
  6. Issue with X axis values NOT graphing on Scatter graph and issue with Labels
    By lmausolf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-17-2012, 07:20 AM
  7. [SOLVED] Issue -Joke thread issue - Mordred
    By Vaibhav in forum Suggestions for Improvement
    Replies: 2
    Last Post: 02-17-2012, 01:31 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1