Getting started with VBA

Chanmingman's Blog

This article is get you started with VBA.

After almost 20 years I have learned VBA, Microsoft never changed Macro to be able to use C# without using Visual Studio. Hence, many people stuck with VBA.

This article will show you how to start VBA in Excel 2013.

1. Start Excel 2013.

2. Go to File Tab -> Options -> Customize Ribbon then enable the Developer tab.

 vba

3. Go to Developer tab choose Insert, under ActiveX choose Command Button.

 vba2

4. Double click the Command Button Excel will bring you to Visual Basic. Type the following code inside the CommandButton1_Click().

Private Sub CommandButton1_Click(

  Worksheets(“Sheet1”).Activate

  Range(“A1”).Value = “1”

End Sub

5. Back to the Excel sheet click the Design Mode to enable to run mode.

Now you can try to click the button.

View original post

How C# 6.0 Simplifies, Clarifies and Condenses Your Code

C# 6.0 isn’t a radical revolution in C# programming. Unlike the introduction of generics in C# 2.0, C# 3.0 and its groundbreaking way to program collections with LlNQ, or the simplification of asynchronous programming patterns in C# 5.0, C# 6.0 isn’t going to transform development. That said, C# 6.0 will change the way you write C# code in specific scenarios, due to features that are so much more efficient you’ll likely forget there was another way to code them. It introduces new syntax shortcuts, reduces the amount of ceremony on occasion, and ultimately makes writing C# code leaner. In this article I’m going to delve into the details of the new C# 6.0 feature set that make all this possible. Specifically, I’ll focus on the items outlined in the Mind Map shown in Figure 1.

dn879355.Michaelis_Figure1_hires(en-us,MSDN.10)

Continue reading

Breaking the CLR Type Safety

Programming fun

As you might have already heard .Net is type safe. Specifically talking CLR provides type safety at runtime, some .Net languages (example: C#) work with CLR to provide type safety at compile time.

So what does the term type safe mean?

Let’s find what Wikipedia says:

In computer science, type safety is the extent to which a programming language discourages or prevents type errors. A type error is erroneous or undesirable program behavior caused by a discrepancy between differing data types for the program’s constants, variables, and methods (functions), e.g., treating an integer (int) as a floating-point number (float). Blah blah blah..

Ok, Now we know that type safety has something to do with preventing the programmer from accessing the type as other than what it is.

Well, C# and CLR are pretty good in this, they work together to push you into the Pit…

View original post 379 more words

Blog at WordPress.com.

Up ↑