VB计数器,从单元格获取数据

时间:2018-11-12 08:53:28

标签: excel vb.net

我有一个问题,就是我没有得到正确的价值

<pre>strASCX = strASCX & "<br><font color=red> " & Sheets(1).Cells(i, j).Value & " </font>"<code>

这应该在我的Excel日历中选择正确的日期(正确的单元格),但事实并非如此。这是我的日历enter image description here的图片的一部分 单词“值”在单元格旁边的位置是“ X”。我应该从这个单元中获得价值。例如,对于单元格B5(查找价格),我应该得到“ value3”

    For i = 3 To 33
    '---Rows---

    For j = 1 To 12
        '---Columns---

        For leto = year(Date) - 1 To year(Date) + 1
            mesec = (j * 3) - 1
            strASCX = strASCX & "if (e.Day.Date.Year == " & leto & "){if (e.Day.Date.Month == " & j & "){if (e.Day.Date.Day ==" & i - 2 & "){aLabel.Text ="""

                    If Sheets(1).Cells(2, mesec + 1) = leto Then
                         If Trim(Sheets(1).Cells(i, mesec)) <> vbNullString Then
                            status = UCase(Trim(Sheets(1).Cells(i, mesec + 1)))
                            Select Case status
                                Case Is = "X"
                                    strASCX = strASCX & "<br><font color=red> " & Sheets(1).Cells(i, j).Value & " </font>"
                            End Select
                         End If
                    End If

            strASCX = strASCX & """;" & "aLabel.ForeColor = System.Drawing.ColorTranslator.FromHtml(""#ccccc2""); e.Cell.Controls.Add(aLabel); }} }" & vbNewLine
        Next leto
    Next j
Next i

0 个答案:

没有答案