V
Varun
Folks,
I am running into application_defined or object-defined error at the PROBLEM
LINE in following code below.
I am assuming that there are more same type error in the code. Please let
me know how to get around this.
Thanks,
Varun
Private Sub CommandButton1_Click()
Dim ddifn As String
Dim ddifnWkBk As Workbook
Dim Di As Variant
Dim Si As Variant
Dim fsl As Integer
Dim fdl As Integer
Dim sth As Integer
Dim dth As Integer
Dim x As Integer
Dim y As Integer
ddifn = Application.GetOpenFilename(FileFilter:="Excel Files, *.xls", _
Title:="Please select layer stackup file received from fab shop")
Set ddifnWkBk = Workbooks.Open(ddifn, , ReadOnly)
'create Temp worksheet
Call CreateTempSheet(ddifnWkBk)
ddifnWkBk.Close
endrows = Worksheets("Temp").UsedRange.Rows.Count
'Find Copper row and column
For copperRows = 1 To endrows
If Worksheets("Temp").Cells(a, b) = "Copper" Then <------PROBLEM LINE
cRow = a
cCol = b
Exit For
End If
Next copperRows
'Find laminate row and column
For laminateRows = 1 To endrows
If Worksheets("Temp").Cells(c, d) = "Laminate / PrePreg:" Then
lRow = c
lCol = d
Exit For
End If
Next laminateRows
'Find Impedance Requirements row and column
For impedance_rows = 1 To endrows
If Worksheets("Temp").Cells(m, n) = "Impedance Requirements:" Then
iRow = m
iCol = n
Exit For
End If
Next impedance_rows
'Find signal/copper layer thicknesses
'cRow is where copper starts and iRow is end (Impedance Requirements)
For i = cRow To iRow
If Worksheets("Temp").Cells(i, cCol) <> "" Then
If fdl <> 0 Then
Di(x) = dth
fdl = 0
x = x + 1
End If
sth = sth + Worksheets("Temp").Cells(i, cCol).Value
fsl = 1
dth = 0
End If
If Worksheets("Temp").Cells(i, lCol) <> "" Then
If fsl <> 0 Then
Si(y) = sth
fsl = 0
y = y + 1
End If
dth = dth + Worksheets("Temp").Cells(i, lCol)
fdl = 1
sth = 0
End If
Next i
Si(y) = sth
End Sub
I am running into application_defined or object-defined error at the PROBLEM
LINE in following code below.
I am assuming that there are more same type error in the code. Please let
me know how to get around this.
Thanks,
Varun
Private Sub CommandButton1_Click()
Dim ddifn As String
Dim ddifnWkBk As Workbook
Dim Di As Variant
Dim Si As Variant
Dim fsl As Integer
Dim fdl As Integer
Dim sth As Integer
Dim dth As Integer
Dim x As Integer
Dim y As Integer
ddifn = Application.GetOpenFilename(FileFilter:="Excel Files, *.xls", _
Title:="Please select layer stackup file received from fab shop")
Set ddifnWkBk = Workbooks.Open(ddifn, , ReadOnly)
'create Temp worksheet
Call CreateTempSheet(ddifnWkBk)
ddifnWkBk.Close
endrows = Worksheets("Temp").UsedRange.Rows.Count
'Find Copper row and column
For copperRows = 1 To endrows
If Worksheets("Temp").Cells(a, b) = "Copper" Then <------PROBLEM LINE
cRow = a
cCol = b
Exit For
End If
Next copperRows
'Find laminate row and column
For laminateRows = 1 To endrows
If Worksheets("Temp").Cells(c, d) = "Laminate / PrePreg:" Then
lRow = c
lCol = d
Exit For
End If
Next laminateRows
'Find Impedance Requirements row and column
For impedance_rows = 1 To endrows
If Worksheets("Temp").Cells(m, n) = "Impedance Requirements:" Then
iRow = m
iCol = n
Exit For
End If
Next impedance_rows
'Find signal/copper layer thicknesses
'cRow is where copper starts and iRow is end (Impedance Requirements)
For i = cRow To iRow
If Worksheets("Temp").Cells(i, cCol) <> "" Then
If fdl <> 0 Then
Di(x) = dth
fdl = 0
x = x + 1
End If
sth = sth + Worksheets("Temp").Cells(i, cCol).Value
fsl = 1
dth = 0
End If
If Worksheets("Temp").Cells(i, lCol) <> "" Then
If fsl <> 0 Then
Si(y) = sth
fsl = 0
y = y + 1
End If
dth = dth + Worksheets("Temp").Cells(i, lCol)
fdl = 1
sth = 0
End If
Next i
Si(y) = sth
End Sub