Results 1 to 5 of 5

Need more efficient VBA code solution -for novice

Threaded View

marcn Need more efficient VBA code... 03-01-2020, 06:06 PM
6StringJazzer Re: Need more efficient VBA... 03-01-2020, 09:28 PM
6StringJazzer Re: Need more efficient VBA... 03-01-2020, 09:49 PM
marcn Re: Need more efficient VBA... 03-02-2020, 11:49 AM
6StringJazzer Re: Need more efficient VBA... 03-02-2020, 12:25 PM
  1. #1
    Registered User
    Join Date
    01-10-2020
    Location
    we
    MS-Off Ver
    10
    Posts
    5

    Need more efficient VBA code solution -for novice

    Sorry, I did not post the other forums requested.

    told I need to add links but denied ... catch 22

    here are the forums... Ozgrid.com, excelforum.com


    I am adding actual sheet for better clarification.

    
    Sub Consult_Monthly_ALL_Yr1()
    
    'declare variables
    
        Application.Goto Reference:="TCS_ALL_YR1"  (Here I define by defined name as I want to goto immediately to choosen line item(s) and for selection to remain same even if I add more rows, ie relative position).
    Dim ws As Worksheet
    Dim rng As Range
    Dim myVal As Range
    Dim J11 As Integer
    Set ws = Worksheets("3a-SalesForecastYear1")
    Set rng = ws.Range("c21:N23")  (But here is the first issue, I not sure how to refer to the above Defined Name (TPC_ALL_YR1).. whatever I try does not work except actual row(s) which)
    For Each myVal In rng
    If J11 < 100 Then
    myVal = myVal.Value * ws.Range("H13")
    ElseIf J11 > 100 Then
    myVal = myVal.Value * ws.Range("H13") + myVal.Value
    End If
    Next myVal
    End Sub
    
    thanks for all the suggestions everyone.
    Attached Files Attached Files
    Last edited by marcn; 03-02-2020 at 11:58 AM. Reason: add code tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. More Efficient Solution to a "Table Lookup Question"?
    By espressonator in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 12-17-2019, 07:06 AM
  2. Novice - Need help to break down code smaller
    By Chris-B. in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 05-12-2018, 01:01 PM
  3. [SOLVED] How to make my Code Clear Contents Code more efficient
    By eazy899 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-07-2018, 10:40 AM
  4. Replies: 1
    Last Post: 01-14-2016, 11:18 AM
  5. [SOLVED] Trying to change verbose looping code into more efficient (and shorter) code please
    By dawatcher in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-03-2013, 07:43 AM
  6. efficient solution to using a master file?
    By adds007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2011, 09:03 AM
  7. [SOLVED] VB code needed as this is way beyond a novice like me!
    By Anthony in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-10-2005, 03:05 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