Hi All:
I have a couple of workbooks open (with a code someone helped with and it works fine).
In my "working" worksheet, which is not included in the workbooks mentioned above, I would like to search for cell C3= Account Name e.g. Hortons and C4= Account Number e.g. 0010456 in the worksheets of the workbook open. The worksheet name is called Raw Data. e.g. in January 2004 workbook, I have a worksheet called Raw Data, in February 2004 workbook, I have another worksheet called Raw Data and the data is presented in the same manner.
My question is: how do I write a maro to search cells c3 & C4 of my working worksheet in the Raw Data worksheets mentioned earlier.
I read somewhere that autofilters are very good with vba. So I think an easier way of searching for the values would be to autofilter the Raw Data worksheets one at a time, and search for the value of c3 of my working worksheet in column A of the first Raw Data worksheet and then perform another autofilter to search in column G of the Raw Data worksheet for the value of c4 of my working worksheet. If excel finds rows that match, it should copy the information found in column A, G, H & K of the raw data worksheets into my working sheet starting at A20, C20 E20 and F20, so, if it finds more than 1 row of matching data, it should find the last row after A20, and insert rows to accomodate the data e.g. A21, C21, E21 and F21 e.t.c. If it doesn't find anything in the Raw Data worksheet for the January 2004 workbook for example, it should move on to the Raw Data worksheet of the February 2004 workbook, until it goes through all the Raw Data worksheets of the workbooks open, if it doesn't find anything, it should leave my workbook as is.
I would like the macro to search each worksheet one at a time because I am not sure it could search the Raw Data worksheets simultaneously.
I know if sounds really complicated, but it may be possible to execute.
Please please help.
I have a couple of workbooks open (with a code someone helped with and it works fine).
In my "working" worksheet, which is not included in the workbooks mentioned above, I would like to search for cell C3= Account Name e.g. Hortons and C4= Account Number e.g. 0010456 in the worksheets of the workbook open. The worksheet name is called Raw Data. e.g. in January 2004 workbook, I have a worksheet called Raw Data, in February 2004 workbook, I have another worksheet called Raw Data and the data is presented in the same manner.
My question is: how do I write a maro to search cells c3 & C4 of my working worksheet in the Raw Data worksheets mentioned earlier.
I read somewhere that autofilters are very good with vba. So I think an easier way of searching for the values would be to autofilter the Raw Data worksheets one at a time, and search for the value of c3 of my working worksheet in column A of the first Raw Data worksheet and then perform another autofilter to search in column G of the Raw Data worksheet for the value of c4 of my working worksheet. If excel finds rows that match, it should copy the information found in column A, G, H & K of the raw data worksheets into my working sheet starting at A20, C20 E20 and F20, so, if it finds more than 1 row of matching data, it should find the last row after A20, and insert rows to accomodate the data e.g. A21, C21, E21 and F21 e.t.c. If it doesn't find anything in the Raw Data worksheet for the January 2004 workbook for example, it should move on to the Raw Data worksheet of the February 2004 workbook, until it goes through all the Raw Data worksheets of the workbooks open, if it doesn't find anything, it should leave my workbook as is.
I would like the macro to search each worksheet one at a time because I am not sure it could search the Raw Data worksheets simultaneously.
I know if sounds really complicated, but it may be possible to execute.
Please please help.