我必须将列(数字)的值添加到基于列(状态)的字典中。 如果列(状态)有E,则添加到dictionary_1 否则,请将其添加到dictionary_2。将单元格值添加到基于其他单元格值的字典
我面临的问题,如果列(号码)同时具有“E”和空白它被添加到两个字典。在下面可以做些什么来纠正这个问题?
Set DATA = wkb.Worksheets("download")
DATA.Activate
currentReadRow_status = START_ROW_DOWNLOAD
currentReadVariable = Trim(CStr(DATA.Cells(currentReadRow, COL_DOWNLOAD_NUMBER)))
download_status = Trim(CStr(DATA.Cells(currentReadRow_status, COL_DOWNLOAD_STATUS)))
While (currentReadVariable <> "")
If (download_status = "E") Then
If Not (DOWNLOAD_ERROR.Exists(currentReadVariable)) Then
DOWNLOAD_ERROR.Add currentReadVariable, download_status
End If
Else
If Not (DOWNLOAD_NOERROR.Exists(currentReadVariable)) Then
DOWNLOAD_NOERROR.Add currentReadVariable, download_status
End If
End If
currentReadRow_status = currentReadRow_status + 1
currentReadVariable = Trim(CStr(DATA.Cells(currentReadRow_status, COL_DOWNLOAD_NUMBER)))
download_status = Trim(CStr(DATA.Cells(currentReadRow_status, COL_DOWNLOAD_STATUS)))
Wend
问题没有共享通常会很快关闭代码... –
添加的问题 –
代码@Vasily你能解释一下作为进一步我是新来的VBA? –