VB的一个错误修正

来源:百度知道 编辑:UC知道 时间:2024/06/15 00:49:20
公司的EXCEL里面有一段语句,是自动给定值的单无格套用格式的,执行的时候报错. Run-time error '13': Type mismatch 错误的一句话为: If cell <> Empty Then
本人是菜鸟,不知道怎么修改,还请高手指点.
Sub colora_new()
'La presente macro colora le celle relative alle misure delle temperature sulle valvole, sede e sezione
'La macro parte a partire dai valori inseriti nella relativa tabella

Worksheets.Application.ScreenUpdating = False

Dim minimo, massimo As Integer
Dim temp(30, 2) As Integer 'temp è un vettore temporaneo creato per inserire i valori di temperatura del range
Dim colour, target As Range
Dim actual As Integer

'creazione del vettore temp
For i = 1 To 30
temp(i, 1) = Cells(10 + i, 245)
temp(i, 2) = Cells(10 + i, 246)
Next

'assegnazione dei colori

Sheets("Profile_Chart").Select
Set colour = Range("C13:C48,BJ13:BJ48,DQ13:DQ48,FX13:FX48,C250:C285,BJ250:BJ285,DQ250:DQ285,FX250:FX28

这是VB编写的EXCEL宏,你发的有问题,错误不在这个过程Sub里,你把所有的宏文件都打开,找到出错的那一句,估计改成If cell.value <> "" Then就没问题了,如果还有问题,HI我