jonnyp138

Board Regular
Joined
May 2, 2015
Messages
50
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
  6. 2011
  7. 2010
  8. 2007
  9. 2003 or older
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Can anyone help with a vba script that will strip each server host and ip address from column B into a new line in a new sheet and apply the solution from column A next to each server in the new sheet?

Example: Current Layout

SolutionsHosts

<colgroup><col width="77"><col width="553"></colgroup><tbody>
</tbody>

Solution1Server1 [10.150.0.157], Server2 [10.150.0.153]
Solution2Server1 [10.150.0.157], Server2 [10.150.0.153]
Solution3Server1 [10.150.0.157], Server2 [10.150.0.153]
Solution4Server1 [10.150.0.157], Server2 [10.150.0.153]
Solution5Server1 [10.150.0.157], Server2 [10.150.0.153]
Solution6Server1 [10.150.0.157], Server2 [10.150.0.153]
Solution7Server1 [10.150.0.157], Server2 [10.150.0.153]
Solution8Server1 [10.150.0.157], Server2 [10.150.0.153]
Solution9Server3 [10.150.0.251], Server4 [10.150.8.252], Server3 [10.150.8.251]
Solution10Server5 [10.150.0.157], Server6 [10.150.0.153]

<colgroup><col><col></colgroup><tbody>
</tbody>

Each server needs seperating to a seperate line with the correct solution next to it?

Hope this makes sense
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Perhaps this:-
Results in sheet2.
Code:
[COLOR="Navy"]Sub[/COLOR] MG27Oct13
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Dic [COLOR="Navy"]As[/COLOR] Object
[COLOR="Navy"]Dim[/COLOR] Sp [COLOR="Navy"]As[/COLOR] Variant, K [COLOR="Navy"]As[/COLOR] Variant, P [COLOR="Navy"]As[/COLOR] Variant, c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("B2"), Range("B" & Rows.Count).End(xlUp))
[COLOR="Navy"]Set[/COLOR] Dic = CreateObject("scripting.dictionary")
Dic.CompareMode = vbTextCompare
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    Sp = Split(Dn.Value, ", ")
    [COLOR="Navy"]For[/COLOR] n = 0 To UBound(Sp)
        [COLOR="Navy"]If[/COLOR] Not Dic.Exists(Sp(n)) [COLOR="Navy"]Then[/COLOR] Dic.Add Sp(n), New Collection
            Dic(CStr(Sp(n))).Add CStr(Dn.Offset(, -1).Value)
     [COLOR="Navy"]Next[/COLOR] n
[COLOR="Navy"]Next[/COLOR] Dn

c = 1
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] K [COLOR="Navy"]In[/COLOR] Dic.keys
   [COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] P [COLOR="Navy"]In[/COLOR] Dic(K)
        c = c + 1
        Sheets("Sheet2").Cells(c, "A") = K
        Sheets("Sheet2").Cells(c, "B") = P
    [COLOR="Navy"]Next[/COLOR] P
 [COLOR="Navy"]Next[/COLOR] K
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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