![]() |
Help again please
Hi guys, I posted a query on this group that was very quickly answered but I
am not sure how to implement it. This is the code as recieved: Try something like this maybe. You will need to name the days five cells mon, tue, wed etc. Assign to a button named "Week Update" or whatever. Change F100 to whatever column suits you. Sub ListJobs() Dim mon As Range Dim tue As Range Dim wed As Range Dim thur As Range Dim fri As Range Range("mon").Copy Range("F100").End(xlUp).Offset(1, 0) Range("tue").Copy Range("F100").End(xlUp).Offset(2, 0) Range("wed").Copy Range("F100").End(xlUp).Offset(2, 0) Range("thur").Copy Range("F100").End(xlUp).Offset(2, 0) Range("fri").Copy Range("F100").End(xlUp).Offset(2, 0) End Sub I have put Dim lines into general declarationss and range("mon") etc into a button. I have in Cells A1:A5 Mon A6:A10 Tue A11:A15 Wed etc.. In cells B1:B25 I have the jobs I have completed for those days, now what I want to happen is for any cell beteen B1:B25 that contains data to be placed to be copied to cells E75 onwards. However when i run the button I get an error message :METHOD 'RANGE' of Object '_Global' Failed and when I press debug it highlights the first line of code: Range("mon").Copy Range("b1:b5").End(xlUp).Offset(1, 0) many thanxs in advance keith |
Help again please
The named ranges need to be on the worksheet. Select a cell and type a name (mon, tues) in the name box OR use the Insert Name (define or create) regards -- tony h ------------------------------------------------------------------------ tony h's Profile: http://www.excelforum.com/member.php...o&userid=21074 View this thread: http://www.excelforum.com/showthread...hreadid=516700 |
Help again please
Are you running xl97?
And are you running the code from a control from the control toolbox toolbar placed on a worksheet? If that's the case, change the .takefocusonclick property to false for that control. Show the control toolbox toolbar. click on the design mode icon rightclick on the control choose properties change .takefocusonclick to false click on the design mode icon (to get out of that mode) Alternatively (if that control doesn't have this property), you could add this to the top of your procedu Activecell.activate (This bug was fixed in xl2k.) Keith Crooks wrote: Hi guys, I posted a query on this group that was very quickly answered but I am not sure how to implement it. This is the code as recieved: Try something like this maybe. You will need to name the days five cells mon, tue, wed etc. Assign to a button named "Week Update" or whatever. Change F100 to whatever column suits you. Sub ListJobs() Dim mon As Range Dim tue As Range Dim wed As Range Dim thur As Range Dim fri As Range Range("mon").Copy Range("F100").End(xlUp).Offset(1, 0) Range("tue").Copy Range("F100").End(xlUp).Offset(2, 0) Range("wed").Copy Range("F100").End(xlUp).Offset(2, 0) Range("thur").Copy Range("F100").End(xlUp).Offset(2, 0) Range("fri").Copy Range("F100").End(xlUp).Offset(2, 0) End Sub I have put Dim lines into general declarationss and range("mon") etc into a button. I have in Cells A1:A5 Mon A6:A10 Tue A11:A15 Wed etc.. In cells B1:B25 I have the jobs I have completed for those days, now what I want to happen is for any cell beteen B1:B25 that contains data to be placed to be copied to cells E75 onwards. However when i run the button I get an error message :METHOD 'RANGE' of Object '_Global' Failed and when I press debug it highlights the first line of code: Range("mon").Copy Range("b1:b5").End(xlUp).Offset(1, 0) many thanxs in advance keith -- Dave Peterson |
Help again please
I did point out the likelyhood of missing named ranges in my early reply. L. Howard Kittle Wrote: Range("mon").Copy Range("b1:b5").End(xlUp).Offset(1, 0) This line is looking for named range "mon" and wants to copy it to the B1:B5 range offset by 1 row. You want it to go to E75. Looks like your biggest error is not naming the ranges as needed. Once named then we can change the old code to this. (minus the 's) -- tony h ------------------------------------------------------------------------ tony h's Profile: http://www.excelforum.com/member.php...o&userid=21074 View this thread: http://www.excelforum.com/showthread...hreadid=516700 |
All times are GMT +1. The time now is 04:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com