Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88066

Pyramid code problem : object not defined

$
0
0

When I run this code block, it produces

runtime error 1004 : application-defined or object defined error

But VBA is working and the debug line should be py.Range(py.Cells(row, coloum + level), py.Cells(row, coloum - level)).Value = "*". How to fix it?

Dim wantnum As Integer
Dim py As Worksheet
Dim inputs As Integer
Dim row As Integer
Dim coloum As Integer
Dim count As Integer
Dim level As Integer



Set py = Sheets("sheet4")

inputs = InputBox(" Enter the pyrimad level you want")

row = 1
coloum = inputs
level = 0

For count = 0 To inputs

    py.Range(py.Cells(row, coloum + level), py.Cells(row, coloum - level)).Value = "*"
    row = row + 1
    level = level + 1

    Debug.Print Error$(count)

Next count

end sub

Viewing all articles
Browse latest Browse all 88066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>