Blogs from Wise Owl on General in VBA macros

Showing blogs 1-9 (out of 9)

Disabling Screen Updates in Excel VBA

Posted by Andrew Gould on 26 November 2015

You can give your VBA code a performance boost by simply turning off screen updating while your code runs. This blog explains how to achieve this and how to create a basic timer to test the results.

Tags:   VBA macros | General    |    Writing VBA | Other

How to create autoshapes, lines and connectors in VBA macros

Posted by Andy Brown on 25 January 2014

You can use Visual Basic within Excel, PowerPoint or Word to draw shapes, format them and even assign macros to run - this long blog gives lots of ideas of how to proceed!

Tags:   VBA macros | General    |    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

Writing recursive programs in VBA

Posted by Andy Brown on 20 February 2012

In certain cases in VBA (displaying the contents of folders, listing hierarchical data) writing a program which calls itself is by far the easiest way to go - this blog gives worked examples of 3 such recursive programs.

Tags:   VBA macros | General    |    Writing VBA | VBA tutorial

Collections, objects, methods and properties in Excel VBA

Posted by Andy Brown on 09 November 2011

Visual Basic for Applications (VBA) is what's called an object-orientated programming language. This blog explains what this means!

Tags:   VBA macros | General    |    Writing VBA | VBA tutorial

Excel VBA training courses: classroom and online

Posted by Andy Brown on 16 August 2011

As well as running introductory and advanced VBA training courses in the UK for small groups, we've also published this online training course teaching how to code macros using Visual Basic for Applications (VBA) within Excel. The tutorial covers everything from basic recording through to creating classes - something for everyone!

Tags:   VBA macros | General    |    Writing VBA | VBA tutorial

Introduction to Visual Basic for Applications (VBA)

Posted by Andrew Gould on 01 July 2011

If you've heard people in your office talking about macros or VBA but don't understand what they mean, this blog series will make everything clear. It's an introduction to the most basic skills you'll need to start creating your own programs in any of the Microsoft Office applications.

Tags:   VBA macros | General    |    Writing VBA | Other

Using sheet codenames in Microsoft Excel VBA

Posted by Michael Allsop on 01 June 2011

Do your macros keep falling over due to users renaming their worksheets in Excel? Read this article to find out if sheet codenames could be the solution you need.

Tags:   VBA macros | General    |    Writing VBA | Other

Commenting out code in VBA

Posted by Andy Brown on 28 April 2011

Commenting code is an art form! This series of blogs explains why, how and when to comment in VBA.

Tags:   VBA macros | General    |    Writing VBA | VBA tutorial
This page has 1 thread Add post
15 Mar 17 at 16:36

Dear Andrew et al I have been studying and enjoying your amazing videos for quite a while a while. I managed to (1). Create a payment system with vba code with application inputbox (2). I created vba code to review the payment system  in (1) to ensure accuracy of date entry. 

The first problem I have now is that when I run the review code and if no change was made to the payment entry in (2), the original entry are being changed to either '£0' or 'false' I have been scouting through the internet for solution to no avail. Please what vba code to write so that the original entry is not changed if no change is made at the review code stage?

The second problem I have is with the following code:

ActiveCell.Value = PaymentAddress
    Worksheets("PCN Form").Select
        For Each Cell In Selection
              Do
            If ActiveCell = "" Then Exit Do
        Cell.Value = UCase(Cell.Value)
        On Error GoTo 0
   Exit Sub
 Loop
 Next Cell

Application.DisplayAlerts = True
Application.ScreenUpdating = True

On Error GoTo 0

End Sub

When I place this code at the begining or middle or procedure, it stops after running without completing other procedures. I have therefore being constrained to put this procedure at the end. Otherwise, would prefer to bring it in the middle.

The third problem I have is how to write a vba code to validate a payment_reference  to contain alphanumeric and also not more than 10 digits.

Can't thank you enough for your amazing videos. Keep us tuned! Kindest regards Zeno

 

16 Mar 17 at 09:01

Hi Zeno,

Thanks for your comments and questions. Your first question is difficult to answer as you haven't shown the code that you've written. I'd suggest using an IF statement to check whether the new value is different to the old value and only write changes to the cell if that is true.

For your second question I have to admit that it's quite difficult to work out what it is you're trying to do! Some of the code you've written, particularly the Do Loop and Exit Sub statements, appear to be unnecessary. If you're simply trying to change the value of a single cell to upper case text then the only line that you need would be something like this:

ActiveCell.Value = UCase(ActiveCell.Value)

For your third question you'll need to know a little about manipulating strings. Fortunately, we have a few videos on this topic. You may find these ones useful:

http://www.wiseowl.co.uk/videos/excelvba/working-with-strings.htm

http://www.wiseowl.co.uk/videos/excelvba/asc-chr-functions.htm

I hope that helps!