Check if Named Range is equal to another Named Range

Patrick

I’m trying to resize a Named Range in Excel if the Named Range “InventoryList” is equal to the Named Range passed into the Sub. I can’t seem to get the correct syntax for this. The "IF" statement is where I'm getting the error. Hopefully someone can help me out.

Thanks in advance.

    Sub Resize_Inventory_Range(InventoryList As Excel.Range)

        Dim xlApp As Excel.Application
        Dim WB As Excel.Workbook
        Dim WS As Excel.Worksheet
        Dim FullInventory As Excel.Range

        xlApp = GetObject(, Constants.ExcelApp)
        WB = xlApp.Workbooks("Product")
        WS = WB.Sheets("Inventory")
        FullInventory = WS.Range("Full_Inventory")

        If InventoryList.Name.Name = "Hardware_Inventory" Then
            FullInventory.Resize(FullInventory.Rows.Count + 1, 4).Name = FullInventory.Name.Name
        End If

    End Sub
Solver Max

You can check if the two ranges are the same by comparing their addresses. For example:

MsgBox InventoryList.Address = FullInventory.Address

Este artigo é coletado da Internet.

Se houver alguma infração, entre em [email protected] Delete.

editar em
0

deixe-me dizer algumas palavras

0comentários
loginDepois de participar da revisão

Artigos relacionados

Reference Specific Row in Named Range within another Named Range

Create a named range based on a value in another column not included in range

Named Range String limitations

Excel - Unicode named cell range

Adding Named Range reference in VBA

How to filter and copy a named range?

Dynamic Named Range - Disparate Cells

Excel VBA - How to check if target is a named range. If yes, paste range

Using query, Import Range and named range to either label the named range or ignore the header

VBA excel macro for a button that selects named reference from a named range

Programmatically build a hyperlink to a named range in Sheets

Google sheet, select columns within a named range

VBA Dynamic Named Range as Listbox RowSource Error

Excel named range starting with C and a digit

Excel VBA - Referencing a named range in a formula

NamedRange referindo-se a outro Named Range

Creating named range based on value in column

Strip away empty columns on the left side of a named range

from within word, copy and paste as picture a named excel range

Is there a way of accessing a named range without knowing which sheet it is on in VBA Excel?

A variable of a Named Range (Excel) in a Userform gives me an error

reading named cells/range from excel with node js

Como obter o intervalo atribuído a Named Range no excel vba?

Google Sheets: Find All Cells Using a Named Range

Insert string("+") into named-range merged-cell but only if empty

Sort Named Range in random part of Worksheet - we couldn't find a range reference or a defined name

Pass value from Excel 2016 userform textbox to a named range if not already in range

Select Until Not Equal Range

Which formula to use if I were to compare values from multiple columns with corresponding values within a named range?

TOP lista

  1. 1

    R Shiny: use HTML em funções (como textInput, checkboxGroupInput)

  2. 2

    O Chromium e o Firefox exibem as cores de maneira diferente e não sei qual deles está fazendo certo

  3. 3

    Como assinar digitalmente um documento PDF com assinatura e texto visíveis usando Java

  4. 4

    R Folheto. Dados de pontos de grupo em células para resumir muitos pontos de dados

  5. 5

    Gerenciar recurso shake de Windows Aero com barra de título personalizado

  6. 6

    Como obter dados API adequados para o aplicativo angular?

  7. 7

    UITextView não está exibindo texto longo

  8. 8

    Por que meus intervalos de confiança de 95% da minha regressão multivariada estão sendo plotados como uma linha de loess?

  9. 9

    Acessando relatório de campanhas na AdMob usando a API do Adsense

  10. 10

    Usando o plug-in Platform.js do Google

  11. 11

    Como posso modificar esse algoritmo de linha de visada para aceitar raios que passam pelos cantos?

  12. 12

    Dependência circular de diálogo personalizado

  13. 13

    Coloque uma caixa de texto HTML em uma imagem em uma posição fixa para site para desktop e celular

  14. 14

    iOS: como adicionar sombra projetada e sombra de traço no UIView?

  15. 15

    Como usar a caixa de diálogo de seleção de nomes com VBA para enviar e-mail para mais de um destinatário?

  16. 16

    Tabela CSS: barra de rolagem para a primeira coluna e largura automática para a coluna restante

  17. 17

    How to create dynamic navigation menu select from database using Codeigniter?

  18. 18

    Converter valores de linha SQL em colunas

  19. 19

    ChartJS, várias linhas no rótulo do gráfico de barras

  20. 20

    用@StyleableRes注释的getStyledAttributes。禁止警告

  21. 21

    não é possível adicionar dependência para com.google.android.gms.tasks.OnSuccessListener

quentelabel

Arquivo