Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 05-12-2017, 08:33 AM
NoSparks NoSparks is offline Excel format Windows 7 64bit Excel format Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Don't know what you're actually working with or its layout so have assumed IP addresses are in column A of Sheet1 starting in A1 and write the result to C1.
Setup a sample test sheet for experimentation.
I suspect the C1 cell will contain more characters than Excel can display but you should be able to copy and paste the entire cell value provided it doesn't exceed 32,767 characters.
Code:
Sub reFormat()
    Dim lr As Long, i As Integer, str As String
    Dim arr As Variant

    lr = Cells(Rows.Count, "A").End(xlUp).Row
    arr = Sheets("Sheet1").Range(Cells(1, 1), Cells(lr, 1)).Value
    str = Chr(39)
    For i = LBound(arr) To UBound(arr)
        str = str & arr(i, 1) & Chr(39) & Chr(44) & Chr(39)
    Next i
    str = Left(str, Len(str) - 2)
    Range("C1").Value = str
End Sub
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to Format a Table Column in Excel Sgt Rock Excel 0 02-14-2015 02:54 PM
Date format in excel vba LaercioNB Excel 3 08-09-2013 06:33 AM
Excel format excel 2010 to format a date jassie Excel 1 03-28-2013 02:33 AM
Need help in format or link in excel handsome1968 Excel 1 05-01-2010 09:20 AM
Excel format Format Excel to look like Word Kilconey Excel 1 04-30-2010 09:42 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:25 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft