Hi there everyone
I need some help defining the best methods of approaching how to achieve a project, as the code examples I've seen so far are either throwing up errors when I modify them (because I'm thick) or because I'm not approaching the code properly.
Basically what I need to do is to
I need some help defining the best methods of approaching how to achieve a project, as the code examples I've seen so far are either throwing up errors when I modify them (because I'm thick) or because I'm not approaching the code properly.
Basically what I need to do is to
- Pull in only the used rows (which will be variable, between say 500 and 1500) from columns A, B, C, E & F from a source workbook and append to a master workbook, and ignore the rest (all columns in the source will end on the same row and the following rows will all be blank). Determining the Used Rows is important.
- I need to re-order those columns slightly in the new workbook.
- I need to assign today's date as a fixed value in Column G.
- I need to pick a given sample (say, 50%) for today's date for a given value in Column C, and enter a fixed value in Column F and H.
- Why are the code examples for this so varied? Ron de Bruin's code in http://msdn.microsoft.com/en-us/libr...ice.12%29.aspx goes on for pages, yet http://www.ozgrid.com/forum/showthread.php?t=86791& p=423613#post423613 seems to achieve the same thing in about 5 lines! If "UsedRange.Rows.Count" gives you the number of used rows in a column, why would you use anything else? I can't help feeling that I'm missing something here, or that UsedRange is unreliable somehow. Is it simply that "End(xlUp).Count" is applicable where there might be a blank entry in the column you're counting? Given that the sheet name will change daily that I'm copying from, am I better to use a FileDialogPicker box to get the user to open the source file, and select the last entry in a row on the sheet, and capture that data?
- This should be a simple copy command, in fact I can probably just modify a recorded macro, right? Given how badly some of my code has disappeared I want to be sure. I should be able to do "copy source.(a4:bEnd) > Destination.(a4:bEnd) / copy source.(e4:eEnd) > Destination.(c4:cEnd) / copy source.(c4:cEnd) > destination.(d4:dEnd) / copy source.(f4:fEnd) > destination.(f4:fEnd)", then end the subroutine, right?
- A dead simple code example from http://www.ozgrid.com/VBA/auto-add-date.htm to add the current date to another column when text is entered which looks perfect. However, because excel doesn't think paste or fill handle is a change event, it doesn't work manually. Should I resort to filling these columns during the copy operation?
- I can randomise the data manually, but I'd like to be able to then pick sample sizes and output those samples in batches. So, a 15% sample of Value 3 in Column C will be split into batches, and then appended onto a checksheet for a staff member to look at, with the staff member's name in Column H of the master workbook. This is where it gets complicated, and I think I might be better off using a macro to do the sample in the workbook, enter the staff member's name in H, and then do the copying manually.
Last edited: