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:
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
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