Hi Jay
Thanks for the feedback. The code is actually quite simple, and very basic, as i am learning, rambling, ( and making the comments up as it were 
! ) as i go along ... Most of the experts here could knock up something better that takes up about 2 lines to do it all!!! ( and takes them probably about 2 seconds to write it!!. )
I will answer all your questions ( If I can ) when i am in me “VBA” periods and post back...
_ While I am here, let me see wot I can answer now....
_ The code as I have written it should not work in your PMW ( I think?? – doesn’t work in mine ). But the fix for that is simple: The current code Sets the ws to a Worksheet in the File in which the macro is in
( the hint in the code is ThisWorkbook ) Here would be one fix
This makes it work at “my End”... in my PMW ( luckily i just recently found out what a PMW is!! - )
Note:
_ 1) The file you are working on ( Selecting a range from ) must be open
_2 ) You need to change CopyPasteJay.xlsm to your file name
_3) The file must be selected, or else the “Selection” will be the selected file ( what you are looking at ) ... so maybe this would be Better:
_ ........................
_ I always did use very much more descriptive names for variables, as a personal choice. But it seemed to give others ( especially experienced users the hump ( get upset ) ) - so I have as a compromise “cut back” a bit. I think it has no effect whatsoever on speed ( But am guessing a bit there) . r and c were the obvious ones i thought to use if i must use short for row and column and also j and i which I seem to remember was like y and x co-ordinates in my school and Army days.... ( Excel is back to front ( I think?? - like y x coordinates instead of x y ) ) but i digress.... Often i use rws or clms instead or ThisRow, ThatRow.
Yes you must be careful with things like Row, Rows etc, but many pros are careless, often using for example cell as a range variable then a typo to cells can be a disaster and vice versa. Personally i would stick with long descriptive variables names... Also Always use a few capitals when defining a variable, like
Dim LongVariable As Long
Then later in the code type it as longvariable in lower case. Then if you spelt it right ( and have Dim ed it right, VBA will convert it to LongVariable, - So then that is a good check against typos..
_ I will get back with all the rest. Not sure when, In Germany it is late and Tomorrow is a national Holiday. But feel free to ramble, I’ll probably learn stuff as well.. I think just about anything can be done with VBA, - just a question of how and/ or how complex, or if it is easier to modify or re-write a code.. My current code uses Arrays, as you noticed, a personal favourite with me. After a Bit of practice it becomes second nature. People are beginning to catch on to the advantages and are going away from using so much interaction with the Spreadsheet,
http://www.excelforum.com/tips-and-t...of-arrays.html
http://www.excelforum.com/excel-prog...ml#post4199233
- Everytime you interact with the spreadsheet it is like slaming the brakes on.. As would be the case with your background coulors idea, but that can be done also. I will have a think how.
Alan
EDIT actually R and C are "reserved" sometimes in formula stuff, so maybe r and c is bad to use ( but most pros do )
Bookmarks