Excel vba tips & tricks
03/01/2022
Hope smiles from the threshold of the year to come, whispering, 'It will be happier.' Happy New Year 2022!!
http://msexcelmania.weebly.com/blog
VBA Code to Get Local IP Address
Public Function getMyIP()
'Related Reference - Microsoft WMI Scripting V1.2 Library (wbemdisp.TLB)
'Define Variable Data Types
Dim objWMI As Object
Dim objQuery As Object
Dim objQueryItem As Object
Dim vIpAddress
'Create WMI Object
Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
'Query WMI
Set objQuery = objWMI.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
'Loop Thru all assigned IP Addresses
For Each objQueryItem In objQuery
Debug.Print vbCrLf & "All Assigned IP Addresses"
For Each vIpAddress In objQueryItem.ipaddress
Debug.Print "User IP - " & vIpAddress
Next
Next
End Function
Press F5 to run the code. You can view the results in the immediate window (Ctrl + G).
23/08/2020
9 quick tips to improve your VBA macro performance.
Tip 1 :
Turn off everything but the essentials in VBA
One of the first things to do when speeding up VBA code is to turn off unnecessary features such as animations, screen updating, automatic calculations, and events while your macro is running. These features can add extra overhead and slow down the macro, particularly if the macro is modifying many cells and triggering lots of screen updates and recalculations.
The below code sample shows you how to enable/disable:
"MkDir" VBA Function Make folders and subfolders using excel VBA Macros.
Click here to claim your Sponsored Listing.
Category
Website
Address
Delhi
110053