Link to home
Start Free TrialLog in
Avatar of Cartillo
CartilloFlag for Malaysia

asked on

Maintain original data format during update

Hi Experts,

I would like to request Experts help. How to prevent the TextBox1 (attached script) at Userform2 doesn’t modify  the actual data format while updating the content.  The userform 2 activated when double click at column J or K for data update. E.g. data at cell J44 and K44 got deleted when update the data via userform. Hope Experts will help me to prevent the original data and the format were distracted while update/amend the content.  



Option Explicit

Private Sub CommandButton1_Click()
    Dim MyArray() As String
    MyArray = Split(Me.TextBox1.Value, vbCrLf)
    
    Sheets("Daily Tracking List").Cells(Selection.Row, "J").Value = Trim(Replace(MyArray(0), "Issues:", ""))
    
    Sheets("Daily Tracking List").Cells(Selection.Row, "K").Value = Trim(Replace(MyArray(2), "Findings/Updates:", ""))
    Unload Me
End Sub

Private Sub CommandButton2_Click()
    Sheets("Daily Tracking List").Cells(Selection.Row, "J").ClearContents
    Sheets("Daily Tracking List").Cells(Selection.Row, "K").ClearContents
    Unload Me
End Sub


Private Sub UserForm_Initialize()
With Me.TextBox1
    .WordWrap = True
    .MultiLine = True
End With
With Sheets("Daily Tracking List")
    Me.TextBox1.Value = "Issues: " & .Cells(Selection.Row, "J") & vbCrLf & vbCrLf & _
        "Findings/Updates: " & .Cells(Selection.Row, "K")
End With
End Sub

Open in new window

DataEntry.xls
ASKER CERTIFIED SOLUTION
Avatar of SiddharthRout
SiddharthRout
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Cartillo

ASKER

Hi Sid,

The data got updated except for data with “Bullet Library” or “numbering library”. Most of the time the actual data was copied over from words document for compilation. Hope we can salvage this object as well while updating the data.
>>>The data got updated except for data with “Bullet Library” or “numbering library”.

Which cell are you referring to?

Sid
Thanks Sid for the help