VBA to append data to existing cells on update

simi_uk

Board Regular
Joined
Oct 16, 2009
Messages
138
hi all,i'm a bit stuck with this and need some assistance in revamping my code (copied at the bottom of my post) to allow the data in a cell to be appended to when updating via a VBA UserForm.What i have is a workbook that contains a demand/ordering system. I have a VBA UserForm (called 'Place Order') that users use to insert basic order data to a worksheet. After committing that data to the worksheet it can then only be updated by use of another separate UserForm (called 'Update Order'). My code for the 'Update Order' process is, at present, made to overwrite all data in the cell being updated and overwrite it with the new data input into the 'Update Order' UserForm.here's a snippet of my code so you can get an idea of what I'm doing at the moment:
Code:
currentSheet = ActiveSheet.Index
datatoFind = InputBox("Demand Number To Progress")
If datatoFind = "" Then Exit Sub
sheetCount = ActiveWorkbook.Sheets.Count
If IsError(CDbl(datatoFind)) = False Then datatoFind = CDbl(datatoFind)
For counter = 1 To sheetCount
Sheets(counter).Activate

'defines the search to column A of the active sheet
Set searchRange = ActiveSheet.Columns(1).Find(What:=datatoFind, LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlColumns, SearchDirection:=xlNext, MatchCase:=False)
If Not searchRange Is Nothing Then
'test to see if the search is successful or not
Worksheets("demands").Unprotect password:="########"
askRemark:
sRemark = InputBox("Enter Hastening Details")
Cells(searchRange.Row, "V").Select
Cells(searchRange.Row, "V").value = sRemark
Cells(searchRange.Row, "V").ClearComments
Cells(searchRange.Row, "V").AddComment.Text Text:="Progressed by " & Environ("UserName") & " on " & Chr(10) & Format(Date, "dd-mm-yyyy")
Worksheets("demands").Protect password:="########"
Exit Sub 'quits when a match is found
End If
Next counter
Sheets(currentSheet).Activate


Worksheets("demands").Protect password:="########"
If searchRange Is Nothing Then msgbox ("Demand not found, unable to progress.") 'searchRange is empty if Demand number was not found
End Sub

As you can probably see, it's a simple code that did what i needed at first. I now need to use the same process to update the the data in column "V" of the row selected by the UserForm and then append the NEW data to what was already there.

For example:

Row 123, Column V (for the record column 'V' is called "Hastening Info") contains the value "Due in from supplier 12-6-2013". Since placing the order, I've had new information advising that this delivery date is not going to be met, so i now need to update this through the above mentioned 'Update Order' UserForm containing the code above. BUT i now need to retain all previous data (i.e. "Due in from supplier 12-6-2013") and append my new information (i.e. "Supplier advised new delivery date 20-6-2013") to it so that i end up with the cell in column 'V' containing the data from before and after the update i.e. "Due in from supplier 12-6-2013. Supplier advised new delivery date 20-6-2013"

Is there a way this can be done??

thanks in advance.

Simi_uk
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
bump......................................................anybody got anything they could suggest at all??
 
Upvote 0
Hi - Did you end up figuring this out? I'm facing the same propblem currently...
 
Upvote 0

Forum statistics

Threads
1,215,223
Messages
6,123,715
Members
449,118
Latest member
MichealRed

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