+ Reply to Thread
Results 1 to 3 of 3

Changing a portion of formula using excel vba

Hybrid View

firetrue Changing a portion of formula... 07-19-2017, 03:12 AM
amarjeet.it Re: Changing a portion of... 07-19-2017, 03:22 AM
firetrue Re: Changing a portion of... 07-19-2017, 03:48 AM
  1. #1
    Registered User
    Join Date
    07-19-2017
    Location
    Singapore
    MS-Off Ver
    2010
    Posts
    3

    Changing a portion of formula using excel vba

    Hello All,

    I am having a problem changing the following:

    Below is an example of the formula in a cell, I have many of this cells in the worksheet.

    =SUMIFS('[Daily Swaps 2017.xlsx]13 Jun 17'!$O$3:$O$1000,'[Daily Swaps 2017.xlsx]13 Jun 17'!$D$3:$D$1000,"AUD*",'[Daily Swaps 2017.xlsx]13 Jun 17'!$A$3:$A$1000,"S/B*")/COUNTIFS('[Daily Swaps 2017.xlsx]13 Jun 17'!$O$3:$O$1000,">0",'[Daily Swaps 2017.xlsx]13 Jun 17'!$D$3:$D$1000,"AUD*",'[Daily Swaps 2017.xlsx]13 Jun 17'!$A$3:$A$1000,"S/B*")

    I wish to change all the 13 Jun 17 to another date such as 15 Jun 17 using vba.

    I am using the following method:

    For i = 1 To 20
    For j = 1 To 20

    Cells(i, j).Formula = Replace(Cells(i, j).Formula, "13 Jun 17", "16 Jul 18")

    Next j
    Next i

    Using this method, I keep running into runtime error 1004.

    However, when i try the following:

    For i = 1 To 20
    For j = 1 To 20

    Cells(i, j).Formula = Replace(Cells(i, j).Formula, "1", "2")

    Next j
    Next i

    All the 1 are replaced with 2.

    Please Help. This does not work when i use "12" and "16" either (extra info)

    Thank You!

  2. #2
    Registered User
    Join Date
    02-22-2013
    Location
    India
    MS-Off Ver
    2010
    Posts
    87

    Re: Changing a portion of formula using excel vba

    can u plz upload the sample data to give better n precise solution in no time

  3. #3
    Registered User
    Join Date
    07-19-2017
    Location
    Singapore
    MS-Off Ver
    2010
    Posts
    3

    Re: Changing a portion of formula using excel vba

    I have attached a picture, please advice if this is sufficient
    Attached Images Attached Images

+ 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] Changing the fill color of a portion of a pie chart based on a cell value
    By sungen99 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 12-29-2016, 11:20 AM
  2. Extract right portion of a formula
    By jeffreybrown in forum Excel General
    Replies: 8
    Last Post: 12-24-2011, 10:20 AM
  3. Portion of formula in another cell
    By dellschipper in forum Excel General
    Replies: 3
    Last Post: 06-22-2011, 03:04 PM
  4. cut a portion of a cell's contents and paste the cut portion into the net column
    By NJEvan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-12-2010, 05:08 AM
  5. Replies: 2
    Last Post: 12-06-2008, 02:41 AM
  6. Changing Case in a Portion of a Cell
    By Bob H in forum Excel General
    Replies: 5
    Last Post: 08-15-2006, 06:15 PM
  7. Buttons in lower portion of workbook appear in upper portion
    By ToferKing in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-22-2006, 01:50 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