Posts

Concatenate range in excel

Concatenate range with your own defined separator Public Function miconcat(ByRef miRange As Range, Optional miDelimiter As String = " ")
    Dim d As Range
    Dim cc As String    Application.Volatile
    For Each d In miRange
        cc = cc & d & miDelimiter
    Next d
        miconcat = cc
    End Function

Inputbox and msgbox area of rectangle

Sub FindAreaRectangle()

   Dim Length As Double
   Dim Width As Double
   Dim Area As Double

   Length = InputBox("Enter Length ", "Enter a Number")
   Width = InputBox("Enter Width", "Enter a Number")

   Area = Length * Width
   MsgBox ("Area of the Rectangle is " & Area)

End Sub

Vba program code hello world

Sub mihello()
MsgBox "Hello World! Monkidea!"
End Sub
www.monkidea.com

How to add vba code program to excel sheet workbook

Step 1: Open an Excel Worksheet
Step 2: Press Alt+F11 to Open VBA Editor
Step 3: Insert a Module from Insert Menu
Step 4: Copy the above code for activating a range and Paste in the code window (VBA Editor)
Step 5: Save the file as macro enabled Worksheet
Step 6: Press ‘F5′ to run it or Keep Pressing ‘F8′ to debug the code line by line and have a look how the Worksheet(s)