我已经搜索了这些问题,发现了一些非常接近的问题,但我仍然做错了什么。我想在以下代码中为工作表名称使用一个变量:
Option Explicit
Dim wrkPro As String
Dim wrkFFIS As String
Sub MainLoop()
'*************************************************************************************************************************
'*
'*************************************************************************************************************************
Dim FFISno As Range '* Admustments
Dim ProTracksno As Range '* Contracts
Dim FFISnx As String '* Corrected Contract Number
Dim PTdte As Date
Dim FFISdte As Date
Dim orow As Integer
Dim frow As Integer
Dim prow As Integer
Dim rngRange As Range
orow = 2 '* Output Row
frow = 2 '* FFIS Row
prow = 7 '* ProTracks Row
'* Set Worksheet for input ...
wrkPro = CStr(Sheets("SysCtrl").Cells(4, 2).Value) & "ProTracts"
wrkFFIS = CStr(Sheets("SysCtrl").Cells(4, 2).Value) & "FFIS"
'* Clear the Recap Sheet
Sheets("Recap").Range("A2, B5000").ClearContents
'* Sheets("Recap").Rows(CStr(orow) & ":" & CStr(Worksheets("Recap").Cells(Rows.Count, 1).End(xlUp).Row)).ClearContents
'* Sheets("Recap").Cells(1, 1).Select
BeginLoop:
'* Do until EOF on ProTracks Table
Do While Sheets(wrkPro).Cells(prow, 7) <> "" And Sheets(wrkFFIS).Cells(frow, 4) <> ""
当我运行它时,我得到了下标超出范围的错误。我已经检查并且变量中具有正确的值,但它没有在 Do While 中将其用作字符串。
我尝试在字符串之前和之后添加 Char(34) 并将 Dim 更改为 Public,如其他帖子中所建议的那样,但没有任何乐趣。
任何建议,将不胜感激。
卡特