I have following Excel VBA code to open Notepad and copy Excel columns into Notepad.
Dim wsSource As Worksheet
Dim rDataRange As Range
Dim rCell As Range
Dim sCellContent As String
Dim sStringout As String
Dim lrowData As Long ' XXX Added
' This is worksheet where data is located.
Set wsSource = ThisWorkbook.Worksheets("Data")
' This is where data to be processed is located.
lrowData = wsSource.Range("G" & Rows.Count).End(xlUp).Row ' XXX Added
Set rDataRange = wsSource.Range("G40:H" & lrowData) ' XXX Modified
' Iterate through all source data cells.
For Each rCell In rDataRange.Columns(1).Cells ' XXX Loop modified
' Add the cell's content to the full output string
sStringout = sStringout & rCell.Value & " " & rCell.Offset(, 1).Value & ";"
Next rCell
' Remove trailing semi-colon
sStringout = Left(sStringout, Len(sStringout) - 1)
' Start Notepad with focus
Shell "C:\windows\system32\notepad.exe", vbNormalFocus
' Put the string into the free notepad.
SendKeys sStringout
This copies everything on one line.
The columns G and H should be copied to two lines.
One for G and below for H.
It should look like.
column G -> mail;policy;E164;VoiceRoutingPolicy;Language;DialPlan
column H -> [email protected];UpgradeToTeams;111111111;VRP-GEN-BE-Europe_Zone2;en-US;BE