I've been battling to get what should be a simple bit of VBA to run: when clicking in a range, that cell within the range is copied and pasted to another location within the same sheet.
Grateful for any help
I've been battling to get what should be a simple bit of VBA to run: when clicking in a range, that cell within the range is copied and pasted to another location within the same sheet.
Grateful for any help
Are you looking to use the SelectionChange event ?
Perhaps you could post what you have in mind... specifics etc...
Below is a very generic approach - would copy intersect of selected range and A1:C10 and paste resulting cells to the first blank row in Column Z (and below / right as appropriate pending size of Intersecting range)
To insert the above right click on Tab of interest and select View Code pasting above into resulting window.Please Login or Register to view this content.
Using the selectionchange event is not necessarily a good thing... you might want to make the action more deliberate (eg DoubleClick)
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Thanks (again) Donkey Ote.
This is how I went about trying to copy, by double clicking on it, a single cell within the range P7:P78 to pasting it in cell C43 on the same sheet:
Needless to say, it didn't work. Nothing happens. Can anyone advise me where I am going wrong,Please Login or Register to view this content.
The BeforeDoubleClick event by default allows only for single cell selection so in truth the code can be condensed
Note that in the above you are always copying the value to C43 (overwriting what was there previously) - this requirement is implied by earlier code.Please Login or Register to view this content.
(the Cancel line cancels the double click so as to prevent you from going into edit mode in the Target cell)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks