Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50094

Cells with a column defined by variable

$
0
0
Hi,

I am using code as below in order to define column as a variable. While it works with defining the row pretty well it fails with the column despite the same method.

with the code below:

Dim wiersz As String
wiersz = 34
Cells(37, wiersz) = "cos"

I am getting the error message "Runtime error '1004': Application-defined or object-defined error"

with the this code everything is fine, do you know why?

Dim wiersz As String
wiersz = 34
Cells(wiersz, 37) = "cos"

regards,

Viewing all articles
Browse latest Browse all 50094

Trending Articles