Excel + blogs from Wise Owl (page 4 of 7)

Showing blogs 61-80 (out of 128)

Want to wind up your neighbour? Try this annoying Excel VBA code!

Posted by Andy Brown on 14 May 2013

If you have a colleague who trusts you, you could always betray this trust by sending them a workbook which misbehaves: it won't close and you can't leave it!

Tags:   Writing VBA | Other    |    VBA macros | Events

Problem with using VBA to create chart labels

Posted by Andy Brown on 04 April 2013

If your chart has more than a thousand data labels, this blog explains why you may experience problems.

Tags:   Excel | Charts    |    Writing VBA | Other    |    VBA macros | Working with charts

An overview of PowerPivot for Excel 2010

Posted by Andy Brown on 31 January 2013

PowerPivot is a superb addition to Excel: it allows you to create pivot tables based on multiple tables taken from a variety of data sources, and its DAX language lets you report any statistic you want. This overview summarises how to get started with PowerPivot, and what it does.

Tags:   Excel | PowerPivot    |    PowerPivot 2010 | General

What's new in Excel 2013

Posted by Andy Brown on 30 January 2013

Excel 2013 contains radical changes to charts, pivot tables and the user interface. This review explains all the new features of Excel 2013

Tags:   Excel | General

Creating a PowerPivot calendar in Access or Excel

Posted by Andy Brown on 16 January 2013

This blog shows you how to create a calendar of dates for use in PowerPivot. Instructions are included for Excel and Access.

Tags:   Excel | PowerPivot    |    PowerPivot 2010 | Calendar

Create a calendar table for PowerPivot or Analysis Services in SQL Server

Posted by Andy Brown on 04 January 2013

This blog includes the SQL script to generate a table of calendar dates for linking to from within PowerPivot or an Analysis Services tabular model.

Tags:   Excel | PowerPivot    |    PowerPivot 2010 | Calendar    |    SQL Server 2012 | SSAS 2012

Write a macro in VBA to fill in an IE form (Internet Explorer)

Posted by Andy Brown on 02 November 2012

You can use VBA to talk to Internet Explorer, providing that you understand the structure of the web page you're talking to. This blog shows how to do this!

Tags:   VBA macros | References    |    Writing VBA | VBA tutorial

Rounding numbers in Excel

Posted by Michael Allsop on 23 October 2012

Up, down, ceiling, floor or multiples… and you thought rounding numbers was simple!

Tags:   Excel | Excel functions

Highlighting negative columns in Excel charts

Posted by Michael Allsop on 01 October 2012

Ever wondered if you can make negative columns automatically turn red in an Excel chart? Well now you can in Excel 2010!

Tags:   Excel | Charts

Some ideas for new features for Microsoft Excel 20xx

Posted by Andy Brown on 24 September 2012

Excel is a great product, but there is always room for improvement. Here Andy Brown considers 12 possible new features for Excel 2020.

Tags:   Musings | The future    |    Excel | General

Using Excel VBA to Label Multiple Series in a Chart

Posted by Andrew Gould on 30 May 2012

This follow-up article to a previous blog describes how to label the data points in multiple series in Excel using VBA.

Tags:   Writing VBA | Other    |    VBA macros | Working with charts

What is PowerPivot for Excel 2010 - an Overview

Posted by Andy Brown on 04 May 2012

PowerPivot for Excel allows you to crunch very large amounts of data quickly, using pivot tables and slicers and other familiar Excel concepts. It also includes the DAX language, allowing you to create complex calculations.

Tags:   Excel | PowerPivot

Capture Excel application events - event sinks

Posted by Andy Brown on 06 March 2012

It's not for the faint-hearted, but there is a way to capture application events (such as someone trying to create a new workbook) in Excel, using something called an event sink.  This blog explains how you might go about creating an event sink.

Tags:   VBA macros | Classes    |    Writing VBA | VBA tutorial

How to Delete Digital Certificates from your Computer

Posted by Andrew Gould on 06 March 2012

Creating a digital certificate for your VBA projects is easy, but deleting them is somewhat less obvious. This blog shows you how to use the certificate manager to remove certificates that you no longer need.

Tags:   VBA macros | General    |    Writing VBA | Other

Collections of class object using Excel VBA

Posted by Andy Brown on 05 March 2012

If you've learnt how to create your own objects using classes in Excel VBA, the next step is to learn how to group them together into collections. This on-line tutorial will show you how.

Tags:   VBA macros | Classes    |    Writing VBA | VBA tutorial

Creating classes in VBA - class modules

Posted by Andy Brown on 05 March 2012

Those who want to add spice to their VBA programming can learn how to create classes, or class modules, and become object-orientated programmers.  It's difficult, but fun - and this multi-part blog will guide you along the way.

Tags:   VBA macros | Classes    |    Writing VBA | VBA tutorial

Using Excel Add-Ins to Share VBA Code

Posted by Andy Brown on 05 March 2012

If you've written a killer function, you'll want to be able to share it between workbooks. The best way to do this is using an add-in.

Tags:   VBA macros | References    |    Writing VBA | VBA tutorial

Protecting Worksheets and Workbooks in Excel

Posted by Andrew Gould on 28 February 2012

If you've ever been annoyed by somebody else changing parts of your Excel workbooks it's a good idea to learn about protection to prevent them from doing it again!

Using Data Validation in Microsoft Excel

Posted by Andrew Gould on 28 February 2012

If you're constantly frustrated by other people entering the wrong values in your spreadsheets why not learn how to use data validation to prevent them? This blog series explains how you can control what other people can do to your spreadsheet.

Advanced controls in userforms with VBA macros

Posted by Andy Brown on 28 February 2012

The two previous parts of this mini-blog have shown how to draw forms and how to write code to handle form events. This final part shows how to add some of the more exotic controls to user forms, like combo boxes, list boxes, multipage controls, spinners and option buttons.

Tags:   VBA macros | User forms    |    Writing VBA | VBA tutorial
This page has 1 thread Add post
04 May 17 at 18:18

Hello,

I'm having troubles in achieving something on excel and I think you are the right guy's to give me a hand with it.

I have an excel sheet that I use for flight simulation and between other things, I want to create a small compus with shapes(arrows) that rotates whenever I add a value to a specific cell. So far I managed to do it but only with a single arrow. When I try to add a second shape it says "Ambiguous name detected worksheet_Change".

I need 2 arrows because one indicates the heading of the aircraft and another indicates the wind.

On VBA I managed to do the following:

Private Sub Worksheet_Change(ByVal Target As Range)
    'event raised when value in cell changed BY USER
    
    Dim KeyCells As Range
    Set KeyCells = Range("Z2")
    If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
        MoveArrowToA1
    End If
End Sub
Sub MoveArrowToA1()
    'Select shape to move
    Dim CellValue As Integer
    Dim CurrentlySelected As Range
    
    Set CurrentlySelected = Selection
    
    CellValue = Sheets("747 lbs").Range("Z2")
    ActiveSheet.Shapes.Range(Array("seta")).Select
    Selection.ShapeRange.Rotation = CellValue + 180 'Plus 180 since 0 pos is down
    
    'Select prev cell that was in use
    CurrentlySelected.Select
    
End Sub

This gives me only the rotation for one of the arrows (shapes), do you have any idea how do I add a second one?

https://drive.google.com/file/d/0B6JMHUkV2NKJRTZVUmRBZER6bVE/view?usp=sharing  On this link there's a picture to give you the idea of what I'm trying to do.

If you need any other information from me, please let me know.

 

 

Thank you very much for all the help you can give me.

 

 

Kindly,

 

 

Edgar Freitas

05 May 17 at 07:05

Hi Edgar, that sounds like a cool idea!

The "ambiguous name detected" error occurs when you create multiple procedures in the same scope with the same name. What I imagine has happened is that you've copied and pasted the Worksheet_Change subroutine to create a separate procedure for the second arrow? Sadly, you can't do it this way - you can only have one Worksheet_Change subroutine per worksheet. The simple solution is to add the code for the second arrow to the same subroutine as the first.

I hope that helps and good luck with the project!

05 May 17 at 18:30

Andrew, I can't thank you enough!! It worked perfectly!!! :D

Thank you so much for your help.

 

Have a great weekend.

 

 

Kindly,

 

Edgar Freitas

05 May 17 at 16:40

Hello Andrew,

Thank you very much for your reply. 

That's exactly what happened. I thought I could simply copy and paste it to create new arrows.

Your solution is: "...to add the code for the second arrow to the same subroutine as the first."

As I'm not good with VBA, could you please indicate me how to do this? I already tried but I think it's not the right way of doing it as I got an error saying "Duplicate declaration on the same scope".

This is how I did it:

Private Sub Worksheet_Change(ByVal Target As Range)
    'event raised when value in cell changed BY USER
    
    Dim KeyCells As Range
    Set KeyCells = Range("Z2")
    If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
        MoveArrowToA1
    End If
    Dim KeyCells As Range
    Set KeyCells = Range("Z3")
    If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
        MoveArrowToA1
    End If
End Sub
Sub MoveArrowToA1()
    'Select shape to move
    Dim CellValue As Integer
    Dim CurrentlySelected As Range
    
    Set CurrentlySelected = Selection
    
    CellValue = Sheets("747 lbs").Range("Z2")
    ActiveSheet.Shapes.Range(Array("seta")).Select
    Selection.ShapeRange.Rotation = CellValue + 180 'Plus 180 since 0 pos is down
    
    'Select prev cell that was in use
    CurrentlySelected.Select
    Dim CellValue As Integer
    Dim CurrentlySelected As Range
    
    Set CurrentlySelected = Selection
    
    CellValue = Sheets("747 lbs").Range("Z3")
    ActiveSheet.Shapes.Range(Array("seta2")).Select
    Selection.ShapeRange.Rotation = CellValue + 180 'Plus 180 since 0 pos is down
    
    'Select prev cell that was in use
    CurrentlySelected.Select
    
End Sub
 

Thank you once more Andrew!

 

Kindly,

 

Edgar Freitas

Andrew G  
05 May 17 at 17:29

Hi Edgar,

In the same way that you can't declare two subroutines with the same name in the same module, you can't declare more than one variable with the same name in the same subroutine.  Simply remove the duplicate Dim statements so that you don't have more than one variable with the same name in a single procedure.

I hope that helps!