drawing shapes using coordinates
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum 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

resolvedResolved · High Priority · Version 2007

replyReply Sat 18 Dec 2010, 12:05Delegate Frederic said...

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

For upcoming training course dates see: Pricing & availability

replyReply Thu 23 Dec 2010, 12:28Trainer Nafeesa said...

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

 

Please browse our web site to find out more about
excel computer training and other Microsoft training courses.

Excel tip:

COUNT function vs COUNTA function

The COUNTA function works in the same way as the COUNT function, except that it will count cells that contain text (labels) and also cells that contain numbers (values). The COUNT function will only count cells that contain numbers. Blank cells are not counted by either the COUNT or the COUNTA function.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard