Results 1 to 7 of 7

VBA - If row XY contains value XY then replace..

Threaded View

valauca VBA - If row XY contains... 09-29-2022, 03:51 AM
Sintek Re: VBA - If row XY contains... 09-29-2022, 04:57 AM
valauca Re: VBA - If row XY contains... 09-29-2022, 05:29 AM
Sintek Re: VBA - If row XY contains... 09-29-2022, 05:39 AM
valauca Re: VBA - If row XY contains... 09-29-2022, 06:02 AM
jindon Re: VBA - If row XY contains... 09-29-2022, 06:29 AM
Sintek Re: VBA - If row XY contains... 09-29-2022, 06:28 AM
  1. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA - If row XY contains value XY then replace..

    Quote Originally Posted by valauca View Post

    IF the value in Column6 > 0 AND Value in Column5 = 0 AND Value in Column8 = 0 THEN Replace the 0 with the value "1000".
    IF (F8>0 AND E8=0 AND H8=0) THEN (E8 AND H8 = 1000)
    Sub test()
        Dim myItem, cols, s As String, e, myVal
        myItem = Array(Array(6, ">0"), Array(5, "=0"), Array(8, "=0"))
        cols = "5,8"
        myVal = "1000"
        With Cells(1).CurrentRegion
            For Each e In myItem
                s = s & "*(" & .Columns(e(0)).Address & e(1) & ")"
            Next
            .Value = Evaluate("if(" & Mid$(s, 2) & "*(isnumber(match(column(" & Cells(1).Resize(, _
                .Columns.Count).Address & "),{" & cols & "},0)))," & myVal & "," & .Address & ")")
        End With
    End Sub
    myVal is the new value to replace,

    other numers are relative column index within the data range.
    Last edited by jindon; 09-29-2022 at 06:53 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Find and Replace Macro to replace list of special characters
    By dcowiesmith in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-22-2021, 02:01 PM
  2. Replies: 0
    Last Post: 02-13-2021, 03:32 AM
  3. Replies: 1
    Last Post: 02-27-2018, 11:22 AM
  4. REPLACE function help replace two separate texts Ctrl H
    By Uldis in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-23-2015, 10:51 AM
  5. [SOLVED] find and replace to not replace characters found as wildcards
    By sabutler4 in forum Excel General
    Replies: 4
    Last Post: 07-03-2013, 06:48 PM
  6. Multiple Find and Replace to replace a list of strings
    By WalterP34 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-11-2011, 07:41 PM
  7. [SOLVED] find and replace - replace data in rows to separated by commas
    By msdker in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-14-2006, 08:10 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