Option Explicit
Option Base 1
Sub Problem1()
Dim nQuarters As Integer ' number of quarters
Dim nProducts As Integer ' number of products
Dim wsData As Worksheet ' worksheet that contains the data
Dim initialRowAddress As String ' initial row address for sums
Dim initialColumnAddress As String ' initial column address for sums
Dim salesHigh As Single ' product with the highest annual sales
Dim salesLow As Integer ' product with the lowest annual sales
Dim productSales() As Single ' array of sales for each product
Dim productCodes() As String ' array of codes for each product
Dim i As Integer ' used as an iterator
Dim salesHighProduct As String ' product with the highest annual sales
Dim salesLowProduct As Integer ' product with the lowest annual sales
Set wsDatasheet = Worksheets("Problem 1") 'the name of the sheet shoulbe "Problem 1"
' Count the number of quarters and products
With wsData.Range("A1") 'should be "A1"
nProducts = Range(.Offset(1, 0), _
.Offset(1, 0).End(xlDown)).Rows.Count - 1
nQuarters = Range(.Offset(0, 1), _
.Offset(0, 1).End(xlToRight)).Columns.Count 1
код не может быть запущен, потому что в коде смещения есть ошибка.