Modify code to have an input box into column CN and Loop

Knockoutpie

Board Regular
Joined
Sep 10, 2018
Messages
116
Office Version
  1. 365
Platform
  1. Windows
This code snippit below loops through and opens URLs in column A, it copies the value in column CL, however i'd lke to remove the msgbox portion and instead have an input portion where the user will input a value which will be entered into CN.

Essentially,

Copy value in CL2, open URL in A2, Input box to have entrer value in CN2 - Loop to next row.


I imagine this would be done through an Input box, can anyone assist with this?

VBA Code:
Sub openurl()

Dim EdgeLocation As String
Dim MyURL As String
Dim i As Integer
Dim ws1 As Worksheet
Dim lastRow As Long
Dim inputValue As Variant ' n

range("A1").Select

lastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

Set ws1 = Sheets("Page1_1")

EdgeLocation = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" 'Location of Edge.exe in your PC

For i = 1 To lastRow

    ' Copy the adjacent value in column CM
    Dim valueToCopy As String
    valueToCopy = ActiveSheet.range("CL" & i).Value
    ActiveSheet.range("CL" & i).Copy
   '  ActiveSheet.range("CL" & i).EntireRow.Interior.Color = RGB(0, 255, 0)

MyURL = ws1.Cells(i, 1)
    Shell (EdgeLocation & " -url -newtab " & MyURL)
    
    

   
'If MsgBox("Continue to the next URL?", vbOKCancel + vbQuestion) = vbOK Then
'Else
'Statements to show before Exit the Process
'MsgBox "You have skipped the Process"

Exit Sub
End If

Next i

End Sub
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Figured it out, just need to add an IF statement to this so that the cancel button works now..

ActiveSheet.range("CN" & i) = InputBox("Enter Y or N for POD", "InputBox Example")
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,409
Members
448,959
Latest member
camelliaCase

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top