【问题标题】:Use =MAX on external workbook using certain variables使用某些变量在外部工作簿上使用 =MAX
【发布时间】:2017-01-10 12:33:08
【问题描述】:

在代码方面我完全是个菜鸟,所以对你即将看到的内容表示歉意。

我有一个工作簿,其中列出了供应商的订单及其价值。我正在尝试创建一个执行以下操作的宏,但我遇到了障碍。

我希望宏检查活动行的单元格 B,然后访问它们的超链接工作簿并在活动行的单元格 D 中输出 =MAX 值。

Sub Find_PO_Total()

Range("Supplier" & ActiveCell.Row).Select

If Range("Supplier" & ActiveCell.Row) = "Supplier1, Supplier2" Then
Range("Value" & ActiveCell.Row).Max ("_hyperlink_here_!G1:G709")

ElseIf Range("Supplier" & ActiveCell.Row) = "Supplier3" Then
    Range("Value" & ActiveCell.Row).Max ("_hyperlink_here_!H1:H709")

ElseIf Range("Supplier" & ActiveCell.Row) = "Supplier4, Supplier5" Then
    Range("Value" & ActiveCell.Row).Max ("_hyperlink_here_!I1:I709")

End If
End Sub

【问题讨论】:

    标签: excel hyperlink macros max vba


    【解决方案1】:

    我已对您的代码进行了必要的更改

    Sub Find_PO_Total()
    
    If Cells(ActiveCell.Row, 2).Value = "Supplier1" Or Cells(ActiveCell.Row, 2).Value = "Supplier2" Then
        Cells(ActiveCell.Row, 4).Value = "=MAX(_hyperlink_here_!G1:G709)"
    
    ElseIf Cells(ActiveCell.Row, 2).Value = "Supplier3" Then
        Cells(ActiveCell.Row, 4).Value = "=MAX(_hyperlink_here_!H1:H709)"
    
    ElseIf Cells(ActiveCell.Row, 2).Value = "Supplier4" Or Cells(ActiveCell.Row, 2).Value = "Supplier5" Then
        Cells(ActiveCell.Row, 4).Value = "=MAX(_hyperlink_here_!I1:I709)"
    End If
    
    End Sub
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-06
      • 1970-01-01
      • 2010-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-17
      • 1970-01-01
      相关资源
      最近更新 更多