我正在试图弄清楚我如何根据活动工作表编号制作补偿。
示例:
现在,在单元格“B1”中的表单编号2中,我有一个17000的数字集 在B8的同一张纸上:BI有一列数字下降了某些值,我想加到我的17000的基数。一旦我制作了一张新纸张,我想要“A1”来获得另外2的价值数字加起来。
我有一个代码“填写”我正在使用的活动工作表。
但是我怎么能在每个新表中将它变为B8栏中的1个位置:B
因此,工作表2具有将使用的值。
依旧等等。
Sub KnopKlik()
Dim WB As Workbook
Dim WS1 As Worksheet
Dim WS2 As Worksheet
Dim WS3 As Worksheet
Dim Active As Worksheet
Dim Titel1
Dim Titel2
Set WB = ActiveWorkbook
Set WS1 = WB.Sheets(1)
Set WS2 = WB.Sheets(2)
Set WS3 = WB.Sheets(3)
Set Active = WB.ActiveSheet
Set MC = Active.Range("B9")
Titel1 = WS2.Range("B1") 'Base number of 17000
Titel2 = WS2.Range("B8") 'Has to be added up to 17000 depanding on sheet number
collum1 = Sheets(3).Cells(1, 3).Value
Application.ScreenUpdating = False
'============================================================
Sheets(1).Visible = True ' Activate Sheets
Sheets(2).Visible = True
Sheets(3).Visible = True
Active.Select
ActiveSheet.Range("A1").Value = "Unit " & (Titel1 + Titel2)
'This is the line that is suppose to write the question i asked.
'=============================================================================
' Between these lines is a bunch of code i left out cause its irrelivant to the question.
'=============================================================================
Application.ScreenUpdating = True
Active.Select
Sheets(1).Visible = xlVeryHidden
Sheets(3).Visible = xlVeryHidden
Sheets(4).Visible = xlVeryHidden
MsgBox ("Done")
End Sub
我希望这个问题不难理解。我得到了我想要的东西,但我觉得很难用英语解释:P
答案 0 :(得分:1)
好的,试试
Titel2 = WS2.cells(4 + activesheet.index,2)