User Posts: Joyanta Mitra
0
How to Use EVEN Function in Excel (5 Examples)
0

The EVEN function in Excel is a tool that can round up a number to the nearest even integer. It takes one argument, which is the number you want to round up. ...

0
How to Use VBA Union Function (3 Examples)
0

The Union function in VBA is a useful tool for combining multiple ranges into a single range. This function can be particularly helpful when working with large ...

0
Reasons And Solutions for Excel Object Required Error in VBA
0

The object required error in VBA occurs when you attempt to perform an operation on a variable or object that is not set or initialized. This error can be ...

0
How to Use Excel Color Scale Based on Text (2 Suitable Examples)
0

You can apply color scales based on values. This is helpful if you want to rapidly recognize particular values depending on their color. Use color scales, for ...

0
How to Perform Workflow Automation in Excel (4 Easy Examples)
0

Doing repetitive work is exhausting sometimes in Excel. We are going to show Excel workflow automation to make your work better. Repetitive work can be done by ...

0
Excel VBA to Find Matching Value in Column (8 Examples)
0

This article will show you how to use Excel VBA to Find Matching Value in Column. With VBA, you can automate the process of searching for specific values or ...

0
[Fixed!!] VBA Sort Not Working in Excel
0

In VBA, sorting data is a common task, but it can be frustrating when the sort function doesn't work as expected. This article will discuss the different ...

0
How to Use Sales Revenue Formula in Excel (6 Suitable Examples)
0

In the business world, calculating sales revenue is a crucial task that helps organizations to monitor their financial performance. Excel, being one of the ...

0
How to Create Heat Map Scatter Plot in Excel (2 Methods)
0

A Heat Map Scatter Plot in Excel is a type of data visualization that can be created in Microsoft Excel to represent the density of data points in a scatter ...

0
How to Plot Quadratic Line of Best Fit in Excel (2 Easy Methods)
0

Excel is a versatile tool that can be used to analyze data and create charts and graphs. One common use of Excel is to plot the best-fit line through a set of ...

0
Pop Up Excel VBA MsgBox When Cell Meets Criteria
0

Looking for ways to pop up Excel VBA MsgBox when cell meets criteria? Then, this is the right place for you. In Microsoft Excel, VBA (Visual Basic for ...

0
How to Use Excel VBA MsgBox Title (5 Examples)
0

VBA is a programming language used to automate tasks in Excel. When creating VBA programs, it's important to display messages to the user, and giving these ...

0
How to Create Radar Chart with Radial Lines in Excel
0

In this article, we are going to represent our data with a Radar Chart with Radial lines in Excel to compare our goal vs our achievement meaning overall ...

0
How to Create Fuel Cost Calculator Using Excel Formula
0

In this article, we are going to create a Fuel Cost Calculator using Excel formula. Here, we are going to give you a very easy way to find out the cost of your ...

0
How to Interpret Pareto Chart in Excel (2 Practical Examples)
0

In this article, we will show you how to interpret Pareto Chart in Excel. Pareto chart is used for finding out what sectors are major contributions to any ...

Browsing All Comments By: Joyanta Mitra
  1. This code will solve your problem. The code has a condition checking values blank or not.

    Sub Duplicates_Dif_Colors()
    Dim RG As Range
    Dim TT As String
    Dim CL As Range
    Dim CR As String
    Dim CP As Range
    Dim CD As Long
    Dim Cltn As Collection
    Dim J As Long
    
    On Error Resume Next
    
    If ActiveWindow.RangeSelection.Count > 1 Then
    TT = ActiveWindow.RangeSelection.AddressLocal
    Else
    TT = ActiveSheet.UsedRange.AddressLocal
    End If
    
    Set RG = Application.InputBox("Select range of data with duplicates:", "Duplicate values with Colors", TT, , , , , 8)
    If RG Is Nothing Then Exit Sub
    
    CD = 2
    Set Cltn = New Collection
    
    For Each CL In RG
    If CL.Value <> "" Then ' check if cell is not blank
    On Error Resume Next
    Cltn.Add CL, CL.Text
    If Err.Number = 457 Then
    CD = CD + 1
    Set CP = Cltn(CL.Text)
    If CP.Interior.ColorIndex = xlNone Then CP.Interior.ColorIndex = CD
    CL.Interior.ColorIndex = CP.Interior.ColorIndex
    ElseIf Err.Number = 9 Then
    MsgBox "Found excessive duplicates", vbCritical, "Duplicates with Colors"
    Exit Sub
    End If
    On Error GoTo 0
    End If
    Next
    End Sub
    

    Output:

    Blank cells not colored

  2. Please write Ticker correctly both in your xlsx file and the code. Do not try to give invalid ticker or outdated ticker. Provide problems in detail for better service please.

  3. First, you have to create different power queries for each worksheet for other tickers and copy the same code. Otherwise, it triggers the first. Then for 10 different tickers,the code is

    
    let
        TickerList = {"AAPL", "GOOG", "MSFT", "AMZN", "FB", "TSLA", "NVDA", "JPM", "BAC", "V"},
        StartDate = Excel.CurrentWorkbook(){[Name="StartDate"]}[Content]{0}[Column1],
        EndDate = Excel.CurrentWorkbook(){[Name="EndDate"]}[Content]{0}[Column1],
        #"Loop Through Tickers" = List.Transform(TickerList, each
            let
                Ticker = _,
                Source = Csv.Document(Web.Contents("https://query1.finance.yahoo.com/v7/finance/download/"&Ticker&"?period1"&StartDate&"&period2"&EndDate),[Delimiter=",", Columns=7, Encoding=1252, QuoteStyle=QuoteStyle.None]),
                #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
                #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", type date}, {"Open", type number}, {"High", type number}, {"Low", type number}, {"Close", type number}, {"Adj Close", type number}, {"Volume", Int64.Type}})
            in
                #"Changed Type"
        ),
        #"Loop Through Tickers1" = #"Loop Through Tickers"{8}
    in
        #"Loop Through Tickers1"

    this code creates 10 tables for 10 different tickers. You have to select one table according to Ticker and hover over the query in Workbook Query Section and press View in Worksheet. You will get the table have to create 10 sheets separately.

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo