Skip to main content

VBA code to open 100 website from excel sheet in Google chrome

Open Multiple Websites with Single Click in Excel Sheet

Imagine you have a list of website addresses (URLs) in an Excel sheet, and you want to open all of them one by one in Google Chrome. You can do this automatically using a special tool called VBA (Visual Basic for Applications) inside Excel. It's like giving Excel a set of instructions to follow.

The provided code is like a set of instructions written in VBA language. It tells Excel to:

1. Get the path where Google Chrome is installed on your computer.

2. Open a new instance of Google Chrome.

3. Go through the list of websites (i.e 100 URLs) listed in the Excel sheet.

4. For each URL, tell Google Chrome to open it.

5. Once all websites are opened, show a message saying it's done.

So, when you run this code in Excel, it will automatically open each website from your list in Google Chrome without you having to do it manually.

Below is a sample VBA code that opens multiple websites in a column i.e 100 websites listed in an Excel sheet in Google Chrome:

Sub OpenWebsitesInChrome() Dim chromePath As String Dim chrome As Object Dim i As Integer Dim ws As Worksheet ' Set the path to your Chrome executable chromePath = "C:\Program Files\Google\Chrome\Application\chrome.exe" ' Set your worksheet Set ws = ThisWorkbook.Sheets("Sheet1") ' Change "Sheet1" to your sheet name ' Create a new instance of Chrome Set chrome = CreateObject("Shell.Application") ' Loop through the URLs in the specified range For i = 1 To 100 ' Adjust the range according to your data If ws.Cells(i, 1).Value <> "" Then ' Open each URL in Chrome chrome.ShellExecute ws.Cells(i, 1).Value, "", "", "", 1 Else MsgBox "No URL found in cell " & ws.Cells(i, 1).Address & ". Skipping..." End If Next i ' Release the Chrome object Set chrome = Nothing MsgBox "Websites opened successfully in Google Chrome." End Sub
Make sure to replace `"C:\Program Files\Google\Chrome\Application\chrome.exe"` with the path to your Google Chrome executable. Also, adjust the sheet name and range where your URLs are located (`Sheet1` and `Cells(i, 1)` respectively). This code is for 100 websites so adjust for the number of websites you have in your list otherwise, it will give an error message until the last target in the code. To run this code, open the Visual Basic for Applications editor in Excel (Alt + F11), insert a new module (Alt + I + M), paste the code into the module window, Save and then close the editor.

Open the sheet where your URLs are listed. Click on Insert Tab, Choose the Shap Button, pick a shape and draw on the sheet where you want.
Write a text on the button and assign the micro `OpenWebsitesInChrome` to the shape. Now when you click the button this will open each website listed in the specified range in Google Chrome.

Comments

Popular posts from this blog

Eid Mubarak Messages and Images

Eid ul Fitr, also known as the "Festival of Breaking the Fast," is one of the most significant religious celebrations in Islam. It marks the end of Ramadan, the holy month of fasting, prayer, reflection, and community. Eid ul Fitr is a joyous occasion that brings together families, friends, and communities to celebrate their faith and gratitude. Eid Mubarak  The observance of Eid ul Fitr begins with the sighting of the new moon, signaling the end of Ramadan. On this day, Muslims gather early in the morning for a special prayer known as the Salat al-Eid. The prayer is usually performed in large congregations at mosques or open prayer grounds, where people come dressed in their finest attire. The sermon delivered during the prayer emphasizes the importance of gratitude, charity, forgiveness, and unity among Muslims. One of the most cherished aspects of Eid ul Fitr is the act of giving Zakat al-Fitr, a form of charity given to the less fortunate before the Eid prayer. This donat

How to buy bitcoin ETFs?

Bitcoin If Bitcoin ETFs are available in your region, here's a general guide on how you might go about buying them: Research and Choose a Bitcoin ETF: Look for Bitcoin ETFs that are available on reputable stock exchanges. These could include names like NYSE or NASDAQ. Research different ETFs to find one that aligns with your investment goals and risk tolerance. Open a Brokerage Account: To buy ETFs, you'll need a brokerage account. Choose a reliable and well-established brokerage platform. Some popular online brokers include eToro, Fidelity, Vanguard, Charles Schwab, and others. Fund Your Account: Deposit funds into your brokerage account. Most brokers accept bank transfers, credit/debit cards, or other payment methods. Search for the Bitcoin ETF Ticker: Once your account is funded, search for the specific Bitcoin ETF you want to buy using its ticker symbol. For example, if the ETF is listed as "XYZ Bitcoin ETF," its ticker might be "XYZ." Place an Order: Ch

Choosing Adventure Over Monotony: Why Taking Risks Matters

  At Trail 7 Margalla Hills Islamabad Life can sometimes feel like being stuck in a never-ending loop, doing the same things over and over again. This routine, called monotony, can drain the excitement out of life. It's like living on autopilot, where days blur into one another, and we forget what it means to truly feel alive. But there's a way out of this monotony: adventure. Adventure involves stepping into the unknown, trying new things, and taking risks. It's the opposite of sticking to the same old routine. Sure, adventures can be scary and challenging. They might push us out of our comfort zones and make us feel uncomfortable. But it's precisely in those moments of discomfort that we grow the most. Think of adventure like a treasure hunt. Sometimes, we have to dig deep and face obstacles to find the hidden gems in life – whether it's new friendships, exciting experiences, or personal growth. Each adventure, big or small, adds colour to our lives and helps us b