+ Reply to Thread
Results 1 to 8 of 8

VBA Sequencing of Formulae Incorrect - How to Amend?

  1. #1
    Registered User
    Join Date
    09-22-2019
    Location
    Bournemouth
    MS-Off Ver
    2007
    Posts
    3

    VBA Sequencing of Formulae Incorrect - How to Amend?

    Hello All, First post so please be kind - I'm trying to run the below onto my spreadsheet but instead of running in sequence, once run, Cell A12 reads "=Sheet2!A11" as the formula - I need this to refer to "A5" as per the sequence. Basic I know but this will be a quick and easy fix on here... please help

    Please Login or Register  to view this content.
    Last edited by AliGW; 09-22-2019 at 08:46 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,061

    Re: Basic VBA issue - need help

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. I shall do it for you this time, although I am not really clear what you're trying to do here.)

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. As you are new here, I shall do it for you this time.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    09-22-2019
    Location
    Bournemouth
    MS-Off Ver
    2007
    Posts
    3

    Re: VBA Sequencing of Formulae Incorrect - How to Amend?

    Thanks for the info Ali, much appreciated for updating my post correctly - I'm unsure if my original post has been taken off or I'm just talking directly to you now.

    Either way below is my data in Excel:

    [Data]
    PR001
    PR001
    PR001
    PR001LXL
    PR001LXL
    PR001LXL
    PR001LXL-RED
    PR001LXL-RED
    PR001LXL-RED
    [Data]

    The last row of the data above is cell A11 which has the formula =Sheet2!A4 but when I run the following code:

    [Code]

    Sub Prices()

    Range("A3").Formula = "=Sheet2!A2"
    Range("A4").Formula = "=Sheet2!A2"
    Range("A5").Formula = "=Sheet2!A2"
    Range("A6").Formula = "=Sheet2!A3"
    Range("A7").Formula = "=Sheet2!A3"
    Range("A8").Formula = "=Sheet2!A3"
    Range("A9").Formula = "=Sheet2!A4"
    Range("A10").Formula = "=Sheet2!A4"
    Range("A11").Formula = "=Sheet2!A4"
    Range("A3:A11").AutoFill Destination:=Range("A3:A1000"), Type:=xlFillDefault

    End Sub
    [code]

    The next cell down, A12 comes back with the forumla "=Sheet2!A11" but I want it to say "=Sheet2!A5"...

    Hope this makes more sense.
    Thanks,
    Jamie.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,922

    Re: VBA Sequencing of Formulae Incorrect - How to Amend?

    I'd suggest you use an INDEX formula instead:

    Please Login or Register  to view this content.
    Rory

  5. #5
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: VBA Sequencing of Formulae Incorrect - How to Amend?

    Data from each row have to be multiply in 3 rows right?
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  6. #6
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: VBA Sequencing of Formulae Incorrect - How to Amend?

    @Rory - nicely done - first time i've seen int()

  7. #7
    Registered User
    Join Date
    09-22-2019
    Location
    Bournemouth
    MS-Off Ver
    2007
    Posts
    3

    Re: VBA Sequencing of Formulae Incorrect - How to Amend?

    Thank you Rory, pretty damn cool

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,922

    Re: VBA Sequencing of Formulae Incorrect - How to Amend?

    Glad to help.

+ 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. Basic issue about percentages (novice)
    By Gepetto in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-23-2016, 12:21 PM
  2. [SOLVED] Issue with basic VBA code If command
    By MikeSta4ord in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-24-2015, 10:58 AM
  3. [SOLVED] Basic issue with array/range For Each loop
    By chrishar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-06-2013, 12:12 AM
  4. [SOLVED] Basic VBA Vlookup Issue
    By NeedForExcel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-23-2013, 01:24 PM
  5. Basic issue with variables
    By milkman2500 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-21-2012, 05:19 PM
  6. Basic drop-down issue
    By stug in forum Excel General
    Replies: 1
    Last Post: 07-09-2012, 04:52 AM
  7. basic commandbar issue
    By upstate_steve in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-15-2005, 12:49 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