+ Reply to Thread
Results 1 to 4 of 4

VBA to change value only when between two other values

  1. #1
    Registered User
    Join Date
    04-18-2012
    Location
    Shreveport, LA, USA
    MS-Off Ver
    Office 2013
    Posts
    63

    VBA to change value only when between two other values

    I have over 5,000 lines of data, and I will have the following scenario occur many times throughout:

    SG EOS
    SG
    TOE OF DITCH

    When the above 3 values display in 3 different cells grouped together like this, I need to change the value in the cell that just says SG to say DAYLIGHT. I'm needing VBA that will go through all 5,000+ lines of data and change these values.

    I used to have something similar that I thought I would be able to change to work, but I can't find it and I could definitely use help with it.

    Attached is a snip from the Excel file showing one of these areas circled.

    Capture2.PNG

    Thank you.

    Edit: I guess the image isn't showing up...
    Last edited by brianfromla; 10-25-2016 at 09:10 AM. Reason: Image not showing up

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA to change value only when between two other values

    It's all but impossible to work from a picture of a spreadsheet.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: VBA to change value only when between two other values

    Perhaps this, change range to suit
    Please Login or Register  to view this content.
    Last edited by StephenR; 10-25-2016 at 09:27 AM.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: VBA to change value only when between two other values

    As Olly said, not easy to work without a real sheet.... but I took a stab at it making some guesses. Give this a go?

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

+ 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. [SOLVED] Macro - To change cell fonts whenever their values change
    By mgs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-22-2012, 03:14 AM
  2. [SOLVED] Macro - To change fonts when their values change
    By mgs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-05-2012, 12:47 PM
  3. Replies: 3
    Last Post: 06-08-2012, 10:17 PM
  4. Replies: 9
    Last Post: 10-31-2011, 03:56 PM
  5. Change Values in Textbox to Change Cell Value
    By imav in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-21-2011, 11:49 AM
  6. Replies: 2
    Last Post: 06-15-2009, 05:31 PM

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