Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dev dev is offline
external usenet poster
 
Posts: 66
Default keep track of previous excel range value after dragdropped...

I am developing a simple app and this app requires keeping track of previous
value entered into a cell before dragging new value on it.

I have an external source from which I dragdrop values into excel cell; but
some cells on my excel sheet already contains data - so I want to append this
new dragged data to my previously existing data on that cell. Which event on
excel should I use to keep track of it?

Currently I am using Workbook_SheetChange event to do this; but when I
dragdrop data on a particular cell that already contains data;
range.cells.value2 in workbook_sheetchange or workbook_SheetSelectionChange
events are giving me the dragged data and overwriting previous existing data
on that cell. How to resolve this issue?

Any help is really appreciated!!

Thank You!!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default keep track of previous excel range value after dragdropped...

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim oldval as Variant
Dim newval as Variant
On Error goto ErrHandler
if lcase(sh.name) = "myname" then
if not intersect(target,worksheets("myname" _
).Range("B5:F30")) is Nothing then
newVal = Target.Value
Application.EnableEvents = False
Application.Undo
Oldval = Target.Value
Target.value = newval

' your decision logic here

end if
End if

ErrHandler:
Application.EnableEvents = True
End Sub

--
Regards,
Tom Ogilvy

"Dev" wrote:

I am developing a simple app and this app requires keeping track of previous
value entered into a cell before dragging new value on it.

I have an external source from which I dragdrop values into excel cell; but
some cells on my excel sheet already contains data - so I want to append this
new dragged data to my previously existing data on that cell. Which event on
excel should I use to keep track of it?

Currently I am using Workbook_SheetChange event to do this; but when I
dragdrop data on a particular cell that already contains data;
range.cells.value2 in workbook_sheetchange or workbook_SheetSelectionChange
events are giving me the dragged data and overwriting previous existing data
on that cell. How to resolve this issue?

Any help is really appreciated!!

Thank You!!

  #3   Report Post  
Posted to microsoft.public.excel.programming
dev dev is offline
external usenet poster
 
Posts: 66
Default keep track of previous excel range value after dragdropped...

Thanks Tom!! It worked.

"Tom Ogilvy" wrote:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim oldval as Variant
Dim newval as Variant
On Error goto ErrHandler
if lcase(sh.name) = "myname" then
if not intersect(target,worksheets("myname" _
).Range("B5:F30")) is Nothing then
newVal = Target.Value
Application.EnableEvents = False
Application.Undo
Oldval = Target.Value
Target.value = newval

' your decision logic here

end if
End if

ErrHandler:
Application.EnableEvents = True
End Sub

--
Regards,
Tom Ogilvy

"Dev" wrote:

I am developing a simple app and this app requires keeping track of previous
value entered into a cell before dragging new value on it.

I have an external source from which I dragdrop values into excel cell; but
some cells on my excel sheet already contains data - so I want to append this
new dragged data to my previously existing data on that cell. Which event on
excel should I use to keep track of it?

Currently I am using Workbook_SheetChange event to do this; but when I
dragdrop data on a particular cell that already contains data;
range.cells.value2 in workbook_sheetchange or workbook_SheetSelectionChange
events are giving me the dragged data and overwriting previous existing data
on that cell. How to resolve this issue?

Any help is really appreciated!!

Thank You!!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
3-Color Scale Vlookup for Current Month/Previous/Pre-Previous NeoFax Excel Discussion (Misc queries) 2 January 8th 10 07:04 PM
Find numbers lower / further than the previous (Track & Field) Mal/Betty Excel Worksheet Functions 2 November 13th 08 06:35 AM
Equal to previous cell and named range KnappH Excel Worksheet Functions 0 March 13th 07 02:28 PM
Using "track changes" to revert to a previous save Sean Carter Excel Discussion (Misc queries) 3 May 23rd 05 04:54 AM
keeping track of a range of cells in another spreadsheet or access database Colin Evans Excel Programming 8 September 29th 04 03:33 AM


All times are GMT +1. The time now is 07:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"