Thank you for Visiting my Blog

Tuesday, 16 May 2017

How to open Webpage using VBA

 
Hello Guys!!
 
below is the code to open webpage using VBA. Provide the URL which you wanted to open at below highlighted line . You even can change the browser as per your convenience.


Sub MyWebpage()

Dim ie As Object

    Set ie = CreateObject("INTERNETEXPLORER.APPLICATION")
    ie.Navigate "
https://www.google.co.in/"
   
      ie.Visible = True
    While ie.Busy
        DoEvents
   Wend



End Sub



Thank you !!!

Sunday, 7 May 2017

How to delete multiple worksheets in one click using Macro



Workbook Name : deletemultiplesheets.xlsm
Worksheet Name :Main
 
 I want to delete all the worksheets except worksheet "Main". Here is the solution  ...........
 Assign the below macro code to SUBMIT button . 


Sub deletemultiplesheets()
'--------------------- Delete multiple Worksheet in one click--------------------------


Dim wBook As Worksheet
Windows("deletemultiplesheets.xlsm").Activate
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False

    For Each wBook In Application.ActiveWorkbook.Worksheets
        If wBook.Name <> "Main" Then
       
        wBook.Delete
       
        End If
    Next
   
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
      
     
End Sub