我是VBA的初学者。我有一个Excel跟踪器如下:
S.NO REGION ASSOCIATE DATE RECEIVED SLA TIME BUY DELIVERED DATE STATUS
1 ME 7-Mar-13 ED 10-Mar-13
2 ME 7-Mar-13 10-Mar-13
3 AFRICA 7-Mar-13 9-Mar-13
4 AFRICA 7-Mar-13 AE 12-Mar-13
5 ASIA 8-Mar-13 11-Mar-13
6 ASIA 9-Mar-13 QR 15-Mar-13
7 AFRICA 10-Mar-13 14-Mar-13
8 ASIA 10-Mar-13 16-Mar-13
9 ME 10-Mar-13 14-Mar-13
10 ASIA 10-Mar-13 DH 17-Mar-13
我必须根据Region Column Dated和Time buy列的值填充SLZ列中的日期。条件如下:
条件:
最后我的报告应该是这样的。
S.NO REGION ASSOCIATE DATE RECEIVED SLA TIME BUY DELIVERED DATE STATUS
1 ME 7-Mar-13 9-Mar-13 ED 10-Mar-13 W SLA
2 ME 7-Mar-13 9-Mar-13 10-Mar-13 O SLA
3 AFRICA 7-Mar-13 9-Mar-13 9-Mar-13 W SLA
4 AFRICA 7-Mar-13 10-Mar-13 AE 12-Mar-13 O SLA
5 ASIA 8-Mar-13 11-Mar-13 11-Mar-13 W SLA
6 ASIA 9-Mar-13 14-Mar-13 QR 15-Mar-13 O SLA
7 AFRICA 10-Mar-13 14-Mar-13 14-Mar-13 W SLA
8 ASIA 10-Mar-13 16-Mar-13 16-Mar-13 W SLA
9 ME 10-Mar-13 14-Mar-13 14-Mar-13 W SLA
10 ASIA 10-Mar-13 17-Mar-13 DH 17-Mar-13 W SLA
有人可以帮我一个宏。如果我得到一个用于至少一个条件检查的宏,我想我可以在其他条件下重新创建它。
答案 0 :(得分:0)
所以你想要的东西是:
dim iCol as integer
dim iRow as integer
dim iRegionCol as integer, iTktReceivedDate as integer
'
'
iRegionCol=2 ' column 2 = column B?
iTktReceivedDate=4 ' column 4 = column D?
'
for iRow=2 to range("A1").end(xldown).row
select case cells(irow,iregioncol).text
case "ME"
' do something like IF cells(irow, iTktReceivedDate) = today() then...
case "Africa"
' do Africa something
case "Asia"
' do something for Asia
end select
next
我希望能让你开始
菲利普