Results 1 to 4 of 4

Thread: Excel VBA Multiple Automatic Goal Seek Required Please Assist us

  1. #1

    Lightbulb Excel VBA Multiple Automatic Goal Seek Required Please Assist us



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hello,

    I would very grateful if you can please help with the problem I have run into. We sell on Amazon and I am trying to automate our costing sheet so based on margins our selling price can be decided. However, I am struggling as the Amazon fee is a % of the price and hence has a further impact on your margin.

    I have uploaded a test excel sheet, with two sheets.


    I have attempted to use a VBA code which is shown below:


    Code:
    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
     
    Dim r As Range
     
    Set r = Range("F2,M2")
    If Intersect(Target, r) Is Nothing Then Exit Sub
    Application.EnableEvents = False
    Range("J2").GoalSeek Goal:=Range("M2"), ChangingCell:=Range("G2")
    Application.EnableEvents = True
    End Sub
    Now, I have a few problems. The code sort of works, however it does not tackle these issues:

    1. It only works for one row at a time, we have thousands of products on our other sheet and I want a code which will cover the entire spreadsheet.

    2. I have to paste this code in every sheet, is there a way to put it on the work book

    3. We want our min price to be written on the min price column, and same with the max price on the max price column, based on the % specified in other column. How can we run this simultaneously?

    4. The cost EX VAT is the addition of B2:E2, however, I have just used F2 which is Cost of EX VAT in the VBA shown, therefore if cost changes, automatically price should change. But this does not work, on the other hand if I specify B2, C2, D2 in the code individually then it works. Why is this?

    I do not have amazing knowledge on VBA as I am learning, any help will be greatly appreciated. If you feel like there is an easier way to complete this task, please do say.

    Thanks for taking time to help or even read this.

    Kind Regards,
    Champaben
    Attached Files Attached Files

  2. #2

  3. #3

    Lightbulb

    Hello,

    Is this not allowed?

    I just wanted to get a quick answer and as much exposure.

    Thanks.

  4. #4
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,276
    Articles
    57
    Blog Entries
    14
    Excel Version
    Excel Office 365 Insider
    Hi there,

    Don't have a problem with cross posting, but please have a quick read of this: http://www.excelguru.ca/content.php?184

    We do have a bit of a catch 22 here in that you haven't got enough posts to be able to provide the links, but we'd prefer a heads up posted in each forum, just so people don't waste their time on it if it's already being/been answered somewhere else.
    Ken Puls, FCPA, FCMA, MS MVP

    Learn to Master Your Data at the Power Query Academy (the world's most comprehensive online Power Query training), with my book M is for Data Monkey, or our new Power Query Recipe cards!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

Posting Permissions

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