Please ALWAYS post your code - especially the line that gives the error.
I suspect that you have not used the "Set" keyword as you set CurrentCell.
> Also, I am trying to concatenate two cells, but retain their formats.
The .Value of a cell is exactly that ... a value. It is not the format.
There is no standard way of combining two cells, including their formats. What is in the two cells you are trying to combine?
Regards, Dave S
----- Original Message -----Sent: Sunday, April 05, 2015 12:07 AMSubject: [ExcelVBA] Re: Simple loop helpSomething 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?
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5863 / Virus Database: 4321/9458 - Release Date: 04/05/15
__._,_.___
Posted by: "David Smart" <smartware.consulting@gmail.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (8) |
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
.
__,_._,___
Tidak ada komentar:
Posting Komentar