开发者

Getting error 438 in a VBA macro

I have the following sub in Excel

Sub MapEditor()
Dim title As String
Dim tx, ty As Integer
Dim wall As String
Dim wx, wy As Integer
Dim fa As String
Dim fax, fay As Integer
Dim ora As String
Dim orax, oray As Integer
Dim datax, datay As Integer
Dim datacolumn, datarow As Integer
datacolumn = ActiveCell.Column
datarow = ActiveCell.Row
Dim dwidth As Integer, dheight As Integer
Dim i As Integer
i = 1
Do While Sheets("BaseDataFightMap").Cells(1, i) <> ""
    Select Case Sheets("BaseDataFightMap").Cells(1, i).Variant
     C开发者_Go百科ase Is = "width"
       dwidth = Sheets("BaseDataFightMap").Cells(Row, i).Value
     Case Is = "height"
        dheight = Sheets("BaseDataFightMap").Cells(Row, i).Value
    End Select
    i = i + 1
Loop

But it's giving me an error 438, what am I doing wrong?


Try changing the Case statements from:

Case Is = "width"

to:

Case "width"


There is no such cell property as variant

 Sheets("BaseDataFightMap").Cells(1, i).Variant

Are you checking the VALUE of cell(1,i)?

Sheets("BaseDataFightMap").Cells(1, i).Value?

Also, in your code the variable Row isn't dimensioned or allocated so these 2 lines will not work yet.

dwidth = Sheets("BaseDataFightMap").Cells(Row, i).Value
dheight = Sheets("BaseDataFightMap").Cells(Row, i).Value
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜