98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Drawing shapes using coordinates contained in cells
Drawing shapes using coordinates contained in cells
Resolved · High Priority · Version 2007
Frederic has attended:
Access Introduction course
Access Intermediate course
Excel VBA Intro Intermediate course
Drawing shapes using coordinates contained in cells
Hello,
I would like to insert circles on sheet (2) of my workbook using the coordinates stored in two columns on sheet (1).
These coordinates are stored as Letters (that will give me the column where to insert the shape) and Numbers (that will give me the row where to insert the shape).
Below is my code so far, but when I run it, it doesn't do much to my second worksheet, actually nothing.
Could you point out where is my mistake please?
Thank you in advance for your help.
Fred.
Sub PopulateKinomeTree()
Dim strCells As String
Dim LocationColumn As String
Dim LocationRow As String
Dim currentRow As Integer
Dim NumberOfRows As Integer
Dim myDocument As Worksheet
Application.ScreenUpdating = False
NumberOfRows = Worksheets(1).Range("D5").CurrentRegion.Rows.Count
MsgBox (NumberOfRows)
For currentRow = 2 To NumberOfRows
On Error Resume Next
LocationColumn = Worksheets(1).Range("D" & currentRow).Text
LocationRow = Worksheets(1).Range("E" & currentRow).Text
strCells = LocationColumn & LocationRow
Set myDocument = Worksheets(2)
myDocument.Shapes.AddShape msoShapeOval, Range("strCells").Left, _
Range("strcells").Top, 8, 8
Next currentRow
Application.ScreenUpdating = True
End Sub
RE: drawing shapes using coordinates contained in cells
Hi Frederic
Thank you for your question & apologies for the delay in getting back to you.
The Excel VBA trainer will respond to your question as soon as possible.
Thank you for your patience.
Regards,
Nafeesa
Microsoft Office Specialist Trainer
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Generating Random NumbersTo generate a random number in Excel use the = RAND() function. |