View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
K_Macd K_Macd is offline
external usenet poster
 
Posts: 54
Default Automate Copy and Paste?

For and Next are paired control statements which means that any code within
them will be repeated whilst the next record meets the earlier For
condition. This contruction is a very common concept in all programing
languages. There is no For statement in your most recent code. Ker 01's
initial response gives a good example of For/Next use.

For what its worth I always have VBA Help open when I am writing code so I
can do quick sorts on any key word (2007 is better than earlier versions).
--
Ken
"Using Dbase dialects since 82"
"Started with Visicalc in the same year"


"Quin" wrote:

I ran the new code alone just to see if I could get a simple text box out of
it on Excel 2007. It also generated a compile error. This is what I put
into "Sheet1"

Sub MakeTextBoxes()

ActiveSheet.Shapes.AddLabel( _
msoTextOrientationHorizontal, _
ActiveSheet.Range("D5").Left, _
ActiveSheet.Range("D5").Top, _
96.75, _
17.25).Select


With Selection.Font
.Name = "Arial"
.Size = 10
End With
Next

End Sub

This code complains "compile error: Next without For".
I don't know enough about VBA to fix the error or combine this code with the
original solution you offered.

I don't think the version of Excel is anything to do with these compile
errors because I have opened this code in "Compatibility Mode" as well as
native 2007 mode.

I hope you can stick with me on this. I think the solution is on the right
track and I would like to take it a step at a time. Perhaps to start, I
would like to find a way to generate a single text box with the contents of
A1 in it.

Quin