- 日志
- 好友
- 卖家信用
- 买家信用
- 注册时间
- 2011-3-31
- 在线时间
- 小时
|
发表于 2011-12-1 22:11:44
|
显示全部楼层
陈酿 发表于 2011-12-1 21:31
改错了,。。。。表头读了,剩下的做,不知道改错哪里了
我把你的附件改了,还是不知道你的是多少,5?
把原来的remark sheet改个名字就可以了,不知道和你的要求一致吗。
Sub Remark()
Dim myRng As Range
Dim i As Long
Dim j As Long
Dim ret
Worksheets("Exterior competition").Copy after:=Worksheets("Exterior competition")
ActiveSheet.Name = "Remark"
Worksheets("Remark").Activate
ActiveCell.CurrentRegion.Select
ret = dosheet("Interior competition", "Exterior competition", "Remark", 5)
End Sub
Function dosheet(sheet1 As String, Sheet2 As String, sheet3 As String, descount As Integer)
Dim StartRow, StartCol, EndRow, EndCol, tmpr, tmpc As Integer
EndRow = Sheets(sheet1).Cells.SpecialCells(xlLastCell).Row
EndCol = Sheets(sheet1).Cells.SpecialCells(xlLastCell).Column
StartRow = 2
StartCol = 2
For tmpr = StartRow To EndRow
For tmpc = StartCol To EndCol
'descount-1为止相乘
If tmpc < descount Then
Sheets(sheet3).Cells(tmpr, tmpc) = Sheets(sheet1).Cells(tmpr, tmpc) * Sheets(Sheet2).Cells(tmpr, tmpc)
Else
'其他COPY
Sheets(sheet3).Cells(tmpr, tmpc) = Sheets(sheet1).Cells(tmpr, tmpc)
End If
Next
Next
End Function
|
评分
-
查看全部评分
|