Hi,
I am hoping someone can help with this problem
I have a simple macro that send details from a calculation spreadsheet to a log book so I can keep a record of all quotations our company does. Currently it simply adds a record to the bottom line. This works fine except when we redo a quote because details are updated. It would be better if I could find the previous record from the tracking number an modify the detail rather than creating multiple records with the same tracking number, or a new tracking number each time.
the existing code is below:
Sub send_to_log()
'
' send_to_log Macro
'
'
Sheets("DetailsToLog").Select
Range("A5:T5").Select
Selection.Copy
Workbooks.Open fileName:="J:\yyyy\xxx\Quotes_Log.xlsx"
Cells(Cells(1048576, 1).End(xlUp).Row + 1, 1).Select
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWorkbook.Save
ActiveWindow.Close
Sheets("QUOTE").Select
Range("A1").Select
End Sub
the range A5:T5 contains the output details of the quote we store. cell f5 contains a unique tracking number (which are all in column f in the log book). What I'd like to do is have a way that the macro searches to see if this unique number already exists in a row. if so it will overwrite that row. otherwise it will append the quote details to the bottom of the log. I’ve tried using a find function but I’m not doing it correctly at all
Ideally I'd put in a warning message if overwriting but this is step two and I think I'll be able to search to find how to do that.
PS the version of excel is 2010 but it is an older .xls book that the macro is in.
I am hoping someone can help with this problem
I have a simple macro that send details from a calculation spreadsheet to a log book so I can keep a record of all quotations our company does. Currently it simply adds a record to the bottom line. This works fine except when we redo a quote because details are updated. It would be better if I could find the previous record from the tracking number an modify the detail rather than creating multiple records with the same tracking number, or a new tracking number each time.
the existing code is below:
Sub send_to_log()
'
' send_to_log Macro
'
'
Sheets("DetailsToLog").Select
Range("A5:T5").Select
Selection.Copy
Workbooks.Open fileName:="J:\yyyy\xxx\Quotes_Log.xlsx"
Cells(Cells(1048576, 1).End(xlUp).Row + 1, 1).Select
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWorkbook.Save
ActiveWindow.Close
Sheets("QUOTE").Select
Range("A1").Select
End Sub
the range A5:T5 contains the output details of the quote we store. cell f5 contains a unique tracking number (which are all in column f in the log book). What I'd like to do is have a way that the macro searches to see if this unique number already exists in a row. if so it will overwrite that row. otherwise it will append the quote details to the bottom of the log. I’ve tried using a find function but I’m not doing it correctly at all
Ideally I'd put in a warning message if overwriting but this is step two and I think I'll be able to search to find how to do that.
PS the version of excel is 2010 but it is an older .xls book that the macro is in.