hi Don This is what I have managed to come up with so far which seems to work but I think its a little crude your opinion would be much apprieciated this is just in a blank worksheet as yet
Sub copy_hours() col = InputBox("What column do you wish to paste data into?") Worksheets("sheet1").Range("e4:e21", "e25:e50").Copy Worksheets("sheet1").Range(col & "4", col & "25").PasteSpecial Paste:=xlPasteValues Worksheets("sheet1").Range("e54:e62", "e66:e98").Copy Worksheets("sheet1").Range(col & "54", col & "66").PasteSpecial Paste:=xlPasteValues Worksheets("sheet1").Range("e102:e187", "e191:e265").Copy Worksheets("sheet1").Range(col & "102", col & "191").PasteSpecial Paste:=xlPasteValues Worksheets("sheet1").Range("e269:e276").Copy Worksheets("sheet1").Range(col & "269").PasteSpecial Paste:=xlPasteValues Dim Rg As Range Set Rg = ActiveSheet.Range("f4:f21", "f25:f50") Rg.Value = 0 Set Rg = ActiveSheet.Range("f54:f62", "f66:f98") Rg.Value = 0 Set Rg = ActiveSheet.Range("f102:f187", "f191:f265") Rg.Value = 0 Set Rg = ActiveSheet.Range("f269:f276") Rg.Value = 0 End Sub On 9 December 2011 13:27, dguillett1 <dguille...@gmail.com> wrote: > Send me your file with a complete explanation (reply to this msg) and > examples. > > > > > Don Guillett > SalesAid Software > dguille...@gmail.com > -----Original Message----- From: trawets > Sent: Friday, December 09, 2011 2:02 AM > > To: MS EXCEL AND VBA MACROS > Subject: Re: $$Excel-Macros$$ choose column when running macro > > > Thanks for your reply > My sheet is probably a bit crude but I'm working on it > the ranges above are just me trying get this working, > what is happening is that I have a list of tasks around 300 or so > which I have to declare a weekly % progress against, these are not > listed from 1 - 300 but something like 4-20, 26-59, 63-92 etc with the > gaps having descriptive text, when I enter the values I convert into a > number of hours, and the purpose of this macro is to take the number > of hours and paste them into another column allowing me to keep a > running total which can be measured against a set budget for each > activity > and then alert by some condition formatting in case of overspend > Hope I've explained enough (file available if required) > Thanks > > On Dec 8, 1:17 pm, "dguillett1" <dguille...@gmail.com> wrote: > >> Easy enough but let's try to fully automate. Why skip a21?? >> Are you saying you want to copy/paste values to B if there is nothing in B >> or to C if there are values in B, to D if values in C??? >> >> Don Guillett >> SalesAid Software >> dguille...@gmail.com >> >> >> >> -----Original Message----- >> From: trawets >> Sent: Thursday, December 08, 2011 3:02 AM >> To: MS EXCEL AND VBA MACROS >> Subject: $$Excel-Macros$$ choose column when running macro >> >> Hi >> I have a little macro that copies values from one column to another >> then returns the first column to zero, what I would like to achieve is >> every time I run the macro it either asks me which column I wish to >> paste value into or auto progresses through the column i.e. B Then C >> then E each time in runs >> Preferably the first where it asks me which column to paste the ranges >> into >> >> Code: >> Sub copy_hours() >> Worksheets("sheet1").Range("**a1:a20", "a22:a44").Copy >> Worksheets("sheet1").Range("**c1", "c22").PasteSpecial >> Paste:=xlPasteValues >> Dim Rg As Range >> Set Rg = ActiveSheet.Range("a1:a20", "a22:a44") >> Rg.Value = 0 >> >> End Subcould anyone suggest how I might achieve this >> >> -- >> FORUM RULES (934+ members already BANNED for violation) >> >> 1) Use concise, accurate thread titles. Poor thread titles, like Please >> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice >> will >> not get quick attention or may not be answered. >> >> 2) Don't post a question in the thread of another member. >> >> 3) Don't post questions regarding breaking or bypassing any security >> measure. >> >> 4) Acknowledge the responses you receive, good or bad. >> >> 5) Cross-promotion of, or links to, forums competitive to this forum in >> signatures are prohibited. >> >> NOTE : Don't ever post personal or confidential data in a workbook. Forum >> owners and members are not responsible for any loss. >> >> ------------------------------**------------------------------** >> -----------------------------**------------- >> To post to this group, send email to excel-macros@googlegroups.com- Hide >> quoted text - >> >> - Show quoted text - >> > > -- > FORUM RULES (934+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > ------------------------------**------------------------------** > ------------------------------**------------ > To post to this group, send email to excel-macros@googlegroups.com > -- > FORUM RULES (934+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > ------------------------------**------------------------------** > ------------------------------**------------ > To post to this group, send email to excel-macros@googlegroups.com > -- Best Regards Stewart -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com