Sabtu, 04 April 2015

[ExcelVBA] Re: Simple loop help


Something odd here. When I run it as "Dim CurrentCell As Long", it works fine, but when I change it to "Dim CurrentCell As Range", I get the error

Run-time error 91

Object variable or With block variable not set.

Also, I am trying to concatenate two cells, but retain their formats. I use:

For i = 1 To 52

      Cells(i, 4).Value = Cells(i, 2).Value & Cells(i, 3).Value
Next i

Cell (i,2) format is ok as is, but cell((i,3) font color is red. I would like to retain both formats after the concatenate. Any thoughts?


Posted by:
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (7)
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: to enter the ezine, then search the ARCHIVES for EXCEL VBA.

Visit our ExcelVBA group home page for more info and support files:

More free tutorials and resources available at:




Tidak ada komentar:

Posting Komentar