To explain: It asks which week>FINDS the column NUMBER for that week in row1>gets the value of col E to that column...Use 60 to test
Option Explicit Sub CopyHoursToSelectedWeek_SAS() Dim lr As Long Dim mwk As Long Dim mw As Range lr = Cells(Rows.Count, 1).End(xlUp).Row On Error Resume Next mwk = InputBox("Transfer data to which week ? ie: 14", "SalesAid Software") Set mw = Rows(1).Find(What:=mwk, After:=Cells(1, "H"), LookIn:=xlValues, _ LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext) If Not mw Is Nothing Then _ Cells(4, mw.Column).Resize(lr).Value = Cells(4, "e").Resize(lr).Value End Sub Don Guillett SalesAid Software dguille...@gmail.com From: Stewart Smith Sent: Saturday, December 10, 2011 11:06 AM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ choose column when running macro Don Thanks very much works a treat, I have been trying to work out how it works beats me though, I really aprieciate your efforts Regards Stewart On 10 December 2011 15:54, dguillett1 <dguille...@gmail.com> wrote: I have created a macro to do as desired. See attached 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 -- 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 -- 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