<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Free Excel\VBA Help Forum</title>
		<link>http://www.ozgrid.com/forum/</link>
		<description><![CDATA[Excel help &amp; best practices. Search that works. Large Google search-able database of Excel &amp; MS Office solutions.]]></description>
		<language>en</language>
		<lastBuildDate>Wed, 16 May 2012 23:45:01 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>120</ttl>
		<image>
			<url>http://www.ozgrid.com/forum/images/misc/rss.png</url>
			<title>Free Excel\VBA Help Forum</title>
			<link>http://www.ozgrid.com/forum/</link>
		</image>
		<item>
			<title>Formula which can calculate how many days in a month and create a column for each day</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165478&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 22:16:21 GMT</pubDate>
			<description><![CDATA[*_Formula which can calculate how many days in a month and create a column for each day. Columns for day 28, 29, 30 or 31 also need the formulas in columns 1 to 27 copied over automatically. [sheet name “LARSheet1 to 12” ]_* 
 
I’m trying to build a  _*“Leave, Attendance Management” system using Excel”*_. I am about 40% there so far. 
 
I have a few problems to tackle which I will post in separate treads and link them back to together; so others can hopefully learn from the help I receive (and my mistakes): 
 
The basic structure of the workbook is as follows: 
  
*12x* main monthly ‘*Leave Attendance Record*’ worksheets (i.emonths April 2012 through to March 2013). [I will refer to these sheets as *LARSheet1* to *LARSheet12*]. 
* 1 x * worksheet which holds ‘data validation’ list...]]></description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div><span style="font-family: Microsoft Sans Serif"><font size="3"><font color="#000000"><b><u>Formula which can calculate how many days in a month and create a column for each day. Columns for day 28, 29, 30 or 31 also need the formulas in columns 1 to 27 copied over automatically. <span style="font-family: Microsoft Sans Serif"><font size="3"><font color="#000000">[sheet name “LARSheet1 to 12” ]</font></font></span></u></b></font></font></span><br />
<br />
I’m trying to build a <font color="#b22222"> <u><b>“Leave, Attendance Management” system using Excel”</b></u></font>. I am about 40% there so far.<br />
<br />
I have a few problems to tackle which I will post in separate treads and link them back to together; so others can hopefully learn from the help I receive (and my mistakes):<br />
<br />
The basic structure of the workbook is as follows:<br />
 <br />
<font size="2"><span style="font-family: Calibri"><font color="#000000"><b>12x</b> main monthly ‘<b>Leave Attendance Record</b>’ worksheets (i.emonths April 2012 through to March 2013). [I will refer to these sheets as </font><i><b><font color="#800080"><span style="font-family: Calibri">LARSheet1</span></font></b></i></span><font color="#000000"><span style="font-family: Calibri"> to </span></font><i><b><font color="#800080"><span style="font-family: Calibri">LARSheet12</span></font></b></i><font color="#000000"><span style="font-family: Calibri">].</span></font><br />
<font color="#000000"><span style="font-family: Calibri"><b> 1 x </b> worksheet which holds ‘data validation’ list andvlook up info. </span></font><font color="#800080"><span style="font-family: Calibri"><i><b>[“FormulaListSheet”]</b></i></span></font><br />
<font color="#000000"><span style="font-family: Calibri"><b> 1 x </b> worksheet acting as a database of staff details andpay numbers. </span></font><i><font color="#800080"><span style="font-family: Calibri"><b>[“StaffdBaseSheet”]</b></span></font></i><br />
<font color="#000000"><span style="font-family: Calibri"><b>1 x</b>  summary page which shows staff reaming leaveallocation. </span></font><font color="#800080"><span style="font-family: Calibri"><i><b>[“SummaryLeaveSheet”]</b></i></span></font><br />
</font><br />
What I’m having problems with at the moment is as follows:<br />
<br />
<br />
A formula or a macro which works out how many days are present in a given month [starting date of month located in <b>cell B10</b>]. <br />
Days 1-27 will be already set up on the sheet. Based upon the monthly value I would like a solution which can calculate how many days are in a month and create a column for days <b>28, 29, 30 </b>or<b> 31 </b>(depending on the month).<br />
<br />
Hopefully I would like it to work like this:<br />
<br />
When the user opens a new worksheet, they first entre the month start date in <b>CELL B10</b>. Hopefully this will trigger columns <b>E13:AH22 </b>to update with the relevant week day &amp; date.<br />
<br />
 <br />
I also need the formulas and formatting in cells <b>AH13:AH100 </b>(column for day <b>27</b>) to copied over automatically.<br />
<br />
<br />
Can anyone help? Cheers moshjosh!<br />
<br />
<br />
Sample of sheet setup:<br />
<br />
<a href="http://www.ozgrid.com/forum/attachment.php?attachmentid=45839&amp;d=1337206554"  title="Name:  screenshot_LARSheet1.jpg
Views: 2
Size:  28.9 KB">screenshot_LARSheet1.jpg</a><br />
<br />
======   ======     ========   ======   =============  ==========  ============   ============  =====  ========= =======<br />
<br />
This is a multi-part project which is collectively known as<font color="#b22222"> <u><b>“Leave, Attendance Management” system using Excel”</b></u></font> . Other parts are found on other treads. I hope to link the thread solutions together so others who wish to do a similar task can hopefully learn from help I receive (and my mistakes).<br />
<br />
The other parts of the system are:<br />
<br />
<b>‘Leave attendance record’ (this thread) </b>worksheets (i.e months April 2012 through to March 2013). [I will refer to these sheets as <i><b><font color="#800080">&quot;LARSheet1&quot;</font></b></i> to <font color="#800080"><i><b>&quot;LARSheet12&quot;</b></i></font> ].<br />
<br />
<b>‘Data validation’ </b>worksheet which holds list and vlook-up info for formulas. [I will refer to these sheet <font color="#800080"><i><b>“FormulaListSheet”</b></i></font> ].<br />
<br />
<b>‘Database’</b> worksheet acting as a of staff details database. [ <font color="#800080"><i><b>“StaffdBaseSheet”</b></i></font> ]<br />
<br />
<b>‘Summary reaming leave’</b> page which shows a summary of staff used leave and calculates reaming leave allocation. [ <font color="#800080"><i><b>“<a href="http://www.ozgrid.com/forum/showthread.php?t=165474" target="_blank">SummaryLeaveSheet</a>”</b></i></font> ]   <br />
<a href="http://www.ozgrid.com/forum/showthread.php?t=165474" target="_blank">http://www.ozgrid.com/forum/showthread.php?t=165474</a></div>


	<div style="padding:10px">

	

	

	
		<fieldset class="fieldset">
			<legend>Attached Images</legend>
			<ul>
			<!-- BEGIN TEMPLATE: postbit_attachment -->
<li>
	<img class="inlineimg" src="http://www.ozgrid.com/forum/images/attach/jpg.gif" alt="File Type: jpg" />
	<a href="http://www.ozgrid.com/forum/attachment.php?attachmentid=45839&amp;d=1337206554" target="_blank">screenshot_LARSheet1.jpg</a> 
(28.9 KB)
</li>
<!-- END TEMPLATE: postbit_attachment -->
			</ul>
			</fieldset>
	

	

	</div>

<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>moshjosh</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165478</guid>
		</item>
		<item>
			<title>Find cell combinations that add up to a given value</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165477&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 22:15:50 GMT</pubDate>
			<description>Is there a way to take a range of values from one column and find which combination(s) of said range equals a sum I am looking for?</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>Is there a way to take a range of values from one column and find which combination(s) of said range equals a sum I am looking for?</div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>AlliD22</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165477</guid>
		</item>
		<item>
			<title>Anable/disable a formula back and forth based on conditions</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165476&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 22:09:36 GMT</pubDate>
			<description><![CDATA[I want to find some type  macro that will allow me use the formula in a cell &#8220;if and only if&#8221; certain conditions are met (ex: adjacent cell is empty),otherwise to just hold the original value that the formula gave me, but I NEED TO BE ABLE TO USE THAT FORMULA AGAIN if adjacent cell becomes empty again. 
 
To give an idea of what I&#8217;m trying to accomplish, I have a two sheets loan program; the 1st sheet calculates  and display predicted monthly payments. On next sheet, I enter the actual payments as they occur every month, which are being pulled from the 1st sheet one by one as I enter payment date and amount paid. When I enter the actual payment, the main sheet takes that payment and automatically updates the loan. Up to that point, everything is working great. 
 
Here is my problem: let&#8217;s...]]></description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div><span style="font-family: Calibri"><font size="3"><font color="#000000">I want to find some type  macro that will allow me use the formula in a cell &#8220;if and only if&#8221; certain conditions are met (ex: adjacent cell is empty),otherwise to just hold the original value that the formula gave me, but I NEED TO BE ABLE TO USE THAT FORMULA AGAIN if adjacent cell becomes empty again.<br />
</font></font></span><br />
<span style="font-family: Calibri"><font color="#000000"><font size="3">To give an idea of what I&#8217;m trying to accomplish, I have a two sheets loan program; the 1st </font><font size="3">sheet calculates  and display predicted monthly payments. On next sheet, I enter the actual payments as they occur every month, which are being pulled from the 1st</font><font size="3"> sheet one by one as I enter payment date and amount paid. When I enter the actual payment, the main sheet takes that payment and automatically updates the loan. Up to that point, everything is working great.<br />
</font></font></span><br />
<span style="font-family: Calibri"><font size="3"><font color="#000000">Here is my problem: let&#8217;s say that a couple of years or months later, my interest rate changes; interest rate for those payments already made will also take the change. NO GOOD. Because of that, every time interest changes, if &#8220;actual payments&#8221; have been made, I have to save the document with different name to keep a record, then delete all data from actual payments, enter the remaining balance with the new interest rate and start all over as a brand new loan. <br />
</font></font></span><br />
<span style="font-family: Calibri"><font size="3"><font color="#000000"> It&#8217;d be awesome if I could find a way to make those values stay the same by disabling the formula if data is present, keeping the formula enabled only for those unpaid future months (no data), BUT at the same time enabling the formula back IF those cells become empty again.   Anyone who could help on how to go around solving this will be greatly appreciated.<br />
<br />
</font></font></span></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>faustogil</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165476</guid>
		</item>
		<item>
			<title>cell color change based on 5 date location conditions</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165475&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 21:32:31 GMT</pubDate>
			<description>I have a 10 column worksheet that I need the first 5 columns to change color based on a date being input into one of the next 5 columns. Example: 
if a date is put in f1 then a1-e1 turns yellow, if a date is put in g1 then a1-e1 turns green and so on for h1 through j1. Then it repeats for a2-e2 based on f2-j2. I want it to base the color coding on each rows date location. This is the 1st time I have used VBA but I figured out how to use the View Code shortcut. Conditional formatting worked when I only needed 3 colors but the worksheet has expanded beyond my ability.</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>I have a 10 column worksheet that I need the first 5 columns to change color based on a date being input into one of the next 5 columns. Example:<br />
if a date is put in f1 then a1-e1 turns yellow, if a date is put in g1 then a1-e1 turns green and so on for h1 through j1. Then it repeats for a2-e2 based on f2-j2. I want it to base the color coding on each rows date location. This is the 1st time I have used VBA but I figured out how to use the View Code shortcut. Conditional formatting worked when I only needed 3 colors but the worksheet has expanded beyond my ability.</div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>gmdrawdy</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165475</guid>
		</item>
		<item>
			<title>Search multiple worksheets for employee no.; count leave taken; summarise one workshe</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165474&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 21:21:58 GMT</pubDate>
			<description><![CDATA[_*Worksheet which summaries staff used leave and calculates reaming leave allocation, all values summarised on new sheet [sheet name &#8220;SummaryLeaveSheet&#8221; ] 
*_ 
Hi all, 
 
I would like help creating a method, formula or VB code which can look through 12 worksheets [named  *&#8220;LARSheet1&#8221;* to *&#8220;LARSheet12&#8221;* ]; find an employee&#8217;s pay number on a row (say *B25*) and return a count of each attendance (&#8220;*a*&#8221;);  lateness (&#8220;*L*&#8221;); holiday (&#8220;*am or pm*&#8221;) or  Sickness (&#8220;*S*&#8221;) record on that row. The row may change on different worksheets but the search method can always use (*B25*) as a starting point.  
 
With the found values, I would like a total count to be returned on a summary worksheet [ *&#8220;SummaryLeaveSheet&#8221;* ] 
 
I would also like to list the dates each leave was recorded on the various...]]></description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div><span style="font-family: Calibri"><font color="#000000"><u><b><span style="font-family: microsoft sans serif"><font size="3">Worksheet which summaries staff used leave and calculates reaming leave allocation, all values summarised on new sheet [sheet name &#8220;SummaryLeaveSheet&#8221; ]<br />
</font></span></b></u><br />
</font></span>Hi all,<br />
<br />
I would like help creating a method, formula or VB code which can look through 12 worksheets [named  <i><b><font color="#800080">&#8220;LARSheet1&#8221;</font></b></i> to <font color="#800080"><i><b>&#8220;LARSheet12&#8221;</b></i></font> ]; find an employee&#8217;s pay number on a row (say <b>B25</b>) and return a count of each attendance (&#8220;<b>a</b>&#8221;);  lateness (&#8220;<b>L</b>&#8221;); holiday (&#8220;<b>am or pm</b>&#8221;) or  Sickness (&#8220;<b>S</b>&#8221;) record on that row. The row may change on different worksheets but the search method can always use (<b>B25</b>) as a starting point. <br />
<br />
With the found values, I would like a total count to be returned on a summary worksheet [ <i><b><font color="#800080">&#8220;SummaryLeaveSheet&#8221;</font></b></i> ]<br />
<br />
I would also like to list the dates each leave was recorded on the various worksheets [i.e &#8220;<font color="#800080"><i><b>LARSheet1&#8221; </b></i></font>to <font color="#800080"><i><b>&#8220;LARSheet12&#8221;</b></i></font> ] in a table.<br />
<br />
Ideally one summery sheet could be used for all employees, the information would update and change based upon a pay number located in a cell linked to a &#8216;data validation&#8217; drop down list.<br />
<br />
Tall order I know&#8230;.. Any help out there???<br />
<br />
<br />
Many thanks, moshjosh<br />
<br />
Example of layout of [&quot;<font color="#800080"><i><b>LARSheet1&quot;</b></i></font> ]<br />
<br />
<a href="http://www.ozgrid.com/forum/attachment.php?attachmentid=45837&amp;d=1337202968"  title="Name:  screenshot_LARSheet1.jpg
Views: 2
Size:  28.9 KB">screenshot_LARSheet1.jpg</a><br />
<div style="text-align: center;">======   ======     ========   ======   =============  ==========  ============   ============  =====  =========   ==========  =======<br />
</div>This is a multi-part project which is collectively known as<font color="#b22222"> <u><b>&#8220;Leave, Attendance Management&#8221; system using Excel&#8221;</b></u></font> . Other parts are found on other treads. I hope to link the thread solutions together so others who wish to do a similar task can hopefully learn from help I receive (and my mistakes).<br />
<br />
The other parts of the system are:<br />
<br />
<b>&#8216;Leave attendance record&#8217; </b>worksheets (i.e months April 2012 through to March 2013). [I will refer to these sheets as <i><b><font color="#800080">&quot;<a href="http://www.ozgrid.com/forum/showthread.php?t=165478" target="_blank">LARSheet1</a>&quot;</font></b></i> to <font color="#800080"><i><b>&quot;LARSheet12&quot;</b></i></font> ].<br />
<a href="http://www.ozgrid.com/forum/showthread.php?t=165478" target="_blank">http://www.ozgrid.com/forum/showthread.php?t=165478</a><br />
<br />
<b>&#8216;Data validation&#8217; </b>worksheet which holds list and vlook-up info for formulas. [I will refer to these sheet <font color="#800080"><i><b>&#8220;FormulaListSheet&#8221;</b></i></font> ].<br />
<br />
<b>&#8216;Database&#8217;</b> worksheet acting as a of staff details database. [ <font color="#800080"><i><b>&#8220;StaffdBaseSheet&#8221;</b></i></font> ]<br />
<br />
<b>&#8216;Summary reaming leave&#8217;</b> page (this thread) which shows a summary of staff used leave and calculates reaming leave allocation. [ <font color="#800080"><i><b>&#8220;SummaryLeaveSheet&#8221;</b></i></font> ]</div>


	<div style="padding:10px">

	

	

	
		<fieldset class="fieldset">
			<legend>Attached Images</legend>
			<ul>
			<!-- BEGIN TEMPLATE: postbit_attachment -->
<li>
	<img class="inlineimg" src="http://www.ozgrid.com/forum/images/attach/jpg.gif" alt="File Type: jpg" />
	<a href="http://www.ozgrid.com/forum/attachment.php?attachmentid=45837&amp;d=1337202968" target="_blank">screenshot_LARSheet1.jpg</a> 
(28.9 KB)
</li>
<!-- END TEMPLATE: postbit_attachment -->
			</ul>
			</fieldset>
	

	

	</div>

<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>moshjosh</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165474</guid>
		</item>
		<item>
			<title>referencing cells from other workbook</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165473&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 21:18:16 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I created uniform .xls workbook that I use to collect data every time new patient arrives (around 20 variables for every patient). I put all filled workbooks in one folder and use a master workbook that creates a list of all other workbooks in a folder.  
 
I would like to add another sheet in a workbook that would use references from a list (something like indirect function wiithout opening every workbook) to create large overview table with 20 columns contaning those 20 variables and every patient in a new row. Could you please help me with vba code, I don't have enough experience to create it from scratch. If you could please suggest me how to do it. 
Folder name is c:\proba, variables are collected in cells from b1 to b20. 
 
 
Thank you in advance]]></description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>Hello,<br />
<br />
I created uniform .xls workbook that I use to collect data every time new patient arrives (around 20 variables for every patient). I put all filled workbooks in one folder and use a master workbook that creates a list of all other workbooks in a folder. <br />
<br />
I would like to add another sheet in a workbook that would use references from a list (something like indirect function wiithout opening every workbook) to create large overview table with 20 columns contaning those 20 variables and every patient in a new row. Could you please help me with vba code, I don't have enough experience to create it from scratch. If you could please suggest me how to do it.<br />
Folder name is c:\proba, variables are collected in cells from b1 to b20.<br />
<br />
<br />
Thank you in advance</div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>Markica85</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165473</guid>
		</item>
		<item>
			<title>Problem with VLOOKUP in VBA</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165472&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 20:54:03 GMT</pubDate>
			<description><![CDATA[Hello everyone! 
 
I am trying to do a vlookup in an excel sheet where the data are found  in a second sheet (library). The code is as follows. When I run the  whole application, I get the #N/A value for all the vlookups (which is  not correct, most values are found in the table). However, when I break  the running of the code at the point just before the beginning of the  code for the vlookups and then continue to run (changing nothing!!!), it  gives the correct results. Could anyone help please? This is very  urgent! Thanks a lot in advance! 
 
<!-- BEGIN TEMPLATE: bbcode_code --> 
<div class="bbcode_container"> 
	<div class="bbcode_description">VB:</div> 
	<pre class="bbcode_code"style="height:48px;">  
<span class="keyword">With</span> Worksheets(dat) <span class="comment">'.....     ...]]></description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>Hello everyone!<br />
<br />
I am trying to do a vlookup in an excel sheet where the data are found  in a second sheet (library). The code is as follows. When I run the  whole application, I get the #N/A value for all the vlookups (which is  not correct, most values are found in the table). However, when I break  the running of the code at the point just before the beginning of the  code for the vlookups and then continue to run (changing nothing!!!), it  gives the correct results. Could anyone help please? This is very  urgent! Thanks a lot in advance!<br />
<br />
<!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div class="bbcode_container">
	<div class="bbcode_description">VB:</div>
	<hr /><code class="bbcode_code"><br /> 
<span class="keyword">With</span> Worksheets(dat)&nbsp; &nbsp; &nbsp; &nbsp; <span class="comment">'.....&nbsp; &nbsp; &nbsp; .Cells(g_i, 5) = myFile.DateLastModified 'GetFileTime&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' BREAK POINT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Cells(g_i, 7) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 2, False) .Cells(g_i, 8) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 3, False) .Cells(g_i, 9) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 4, False) .Cells(g_i, 10) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 5, False) .Cells(g_i, 11) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 6, False) .Cells(g_i, 12) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 7, False) .Cells(g_i, 13) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 8, False) .Cells(g_i, 14) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 9, False) .Cells(g_i, 15) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 10, False) .Cells(g_i, 16) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 11, False) .Cells(g_i, 17) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 12, False)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End With&nbsp; &nbsp; &nbsp; &nbsp;  g_i = g_i + 1</span>

</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>smanvb</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165472</guid>
		</item>
		<item>
			<title>Problem with VLOOKUP in VBA</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165471&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 20:51:56 GMT</pubDate>
			<description><![CDATA[Hello everyone! 
 
I am trying to do a vlookup in an excel sheet where the data are found  in a second sheet (library). The code is as follows. When I run the  whole application, I get the #N/A value for all the vlookups (which is  not correct, most values are found in the table). However, when I break  the running of the code at the point just before the beginning of the  code for the vlookups and then continue to run (changing nothing!!!), it  gives the correct results. Could anyone help please? This is very  urgent! Thanks a lot in advance!<!-- BEGIN TEMPLATE: bbcode_code --> 
<div class="bbcode_container"> 
	<div class="bbcode_description">VB:</div> 
	<pre class="bbcode_code"style="height:36px;"><span class="keyword">With</span> Worksheets(dat) <span class="comment">'.....     ...]]></description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>Hello everyone!<br />
<br />
I am trying to do a vlookup in an excel sheet where the data are found  in a second sheet (library). The code is as follows. When I run the  whole application, I get the #N/A value for all the vlookups (which is  not correct, most values are found in the table). However, when I break  the running of the code at the point just before the beginning of the  code for the vlookups and then continue to run (changing nothing!!!), it  gives the correct results. Could anyone help please? This is very  urgent! Thanks a lot in advance!<!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div class="bbcode_container">
	<div class="bbcode_description">VB:</div>
	<hr /><code class="bbcode_code"><span class="keyword">With</span> Worksheets(dat)&nbsp; &nbsp; &nbsp; &nbsp; <span class="comment">'.....&nbsp; &nbsp; &nbsp; .Cells(g_i, 5) = myFile.DateLastModified 'GetFileTime&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' BREAK POINT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Cells(g_i, 7) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 2, False) .Cells(g_i, 8) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 3, False) .Cells(g_i, 9) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 4, False) .Cells(g_i, 10) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 5, False) .Cells(g_i, 11) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 6, False) .Cells(g_i, 12) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 7, False) .Cells(g_i, 13) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 8, False) .Cells(g_i, 14) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 9, False) .Cells(g_i, 15) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 10, False) .Cells(g_i, 16) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 11, False) .Cells(g_i, 17) = Application.VLookup(Cells(g_i, 2), Sheets("library").Columns("A:L"), 12, False)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End With&nbsp; &nbsp; &nbsp; &nbsp;  g_i = g_i + 1</span>

</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>smanvb</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165471</guid>
		</item>
		<item>
			<title>Excel VBA - how to capture the first 5 chars from a text cell and use in vlookup</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165470&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 20:43:56 GMT</pubDate>
			<description><![CDATA[Folks, I have started using VBA and although have found many answers I am still only taking small steps. 
I want to use vlookup. I have managed to get this to work when my cell reference is simple, but when the text string greater than my needs I need to shorten to the first 5 characters only. 
I have the feeling that my issue is incorrect use of LEFT.. 
 
what I'd like to know, other than the answer :o) is for a none coder should I give up or can you point me to any tutorials? 
btw I am fine using excel functions and sql.. just not VBA! 
 
Any help would be greatly appreciated. 
 
Garry]]></description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>Folks, I have started using VBA and although have found many answers I am still only taking small steps.<br />
I want to use vlookup. I have managed to get this to work when my cell reference is simple, but when the text string greater than my needs I need to shorten to the first 5 characters only.<br />
I have the feeling that my issue is incorrect use of LEFT..<br />
<br />
what I'd like to know, other than the answer :o) is for a none coder should I give up or can you point me to any tutorials?<br />
btw I am fine using excel functions and sql.. just not VBA!<br />
<br />
Any help would be greatly appreciated.<br />
<br />
Garry<br />
<br />
<!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div class="bbcode_container">
	<div class="bbcode_description">VB:</div>
	<hr /><code class="bbcode_code"><span class="keyword">Sub</span> vbvlookup()<br /> 
    Range("G1").Formula = "=vlookup((newString = left(A18, 5)),'C:\path\name.xls&#93;Summary'!$B$2:$N$126,9,FALSE)"<br /> 
    Range("G1").Value = Range("G1").Value<br /> 
<span class="keyword">End Sub</span> 

</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>garryl</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165470</guid>
		</item>
		<item>
			<title>ADVANCED CHALLENGE: Formulas to Determine Accrued Commissions by Month</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165469&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 20:39:01 GMT</pubDate>
			<description>Howdy, 
 
I have an interesting challenge for you... can you deduce a formula for the following scenario? 
 
Suppose you have a table with calendar months as columns (4 years worth = 48 columns) and individual salespeople as rows.  
 
Each time a salesperson makes a sale, he receives the following annual commission (divide by 12 to spread among each month): 
Year 1 (Months 1-12): 80% 
Year 2 (Months 13-24): 78% 
Year 3 (Months 25-36): 76%</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div><font color="#333333">Howdy,</font><br />
<br />
<font color="#333333">I have an interesting challenge for you... can you deduce a formula for the following scenario?</font><br />
<br />
<font color="#333333">Suppose you have a table with calendar months as columns (4 years worth = 48 columns) and individual salespeople as rows. </font><br />
<br />
<font color="#333333">Each time a salesperson makes a sale, he receives the following annual commission (divide by 12 to spread among each month):</font><br />
<font color="#333333">Year 1 (Months 1-12): 80%</font><br />
<font color="#333333">Year 2 (Months 13-24): 78%</font><br />
<font color="#333333">Year 3 (Months 25-36): 76%</font><br />
<font color="#333333">Year 4 (Months 37-48): 74%</font><br />
<font color="#333333">Year 5+ (Months 49+): 0%</font><br />
<br />
<font color="#333333">So for every sale, he receives a staggered commission over the next 4 years. </font><br />
<br />
<font color="#333333">If each salesperson sells multiple widgets of the four year period, that calendar month's commission must account for the timing of each sale. For example, let's suppose we want to calculate commissions for Bob in April 2012. In the past 4 years, Bob sold a widget in May 2008, July 2009, September 2010, and November 2011. The widget costs $100.</font><br />
<br />
<font color="#333333">He would receive a sum of the following:</font><br />
<br />
<font color="#333333">May 2008: Aged 47 months (0.74/12)*$100= $6.17</font><br />
<font color="#333333">July 2009: Aged 33 months (0.76/12)*$100= $6.33</font><br />
<font color="#333333">Sept 2010: Aged 19 months (0.78/12)*$100= $6.50</font><br />
<u>Nov 2011: Aged 5 months</u><u>(0.80/12)*$100= $6.67</u><br />
<br />
<b>Total for April 2012: = 6.17+6.33+6.5+6.67 = 25.67<br />
<br />
What series of formulas would deliver the accrued commission for each salesperson in each calendar month? <img src="http://www.excelforum.com/images/smilies/smile.gif" border="0" alt="" /><br />
<br />
<i>(Forgive me for not attaching a spreadsheet illustrating the example; our proxy server prohibits me from uploading files)<br />
</i></b><font size="1"><br />
This challenge was also posted on</font><font size="2"> <a href="http://www.excelforum.com/excel-general/831663-advanced-challenge-staggered-commissions-schedule.html" target="_blank" rel="nofollow">http://www.excelforum.com/excel-gene...-schedule.html</a></font></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>ibanker</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165469</guid>
		</item>
		<item>
			<title>Macro Create folder and save file from cell contents into existing directory</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165468&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 20:21:29 GMT</pubDate>
			<description><![CDATA[I have a spreadsheet and I need to be able to create a macro that will do the following: 
 
create a new subfolder from the value in cell I25 ("info" tab) 
The folder needs to be created in an existing directory from the value in cell O8 ("info" tab) 
The file needs to be saved in the subfolder just created with the file name that is listed in cell J32 ('info" tab) 
 
The file name (listed in cell J32) already includes the file extension of ".xlsm", however if it makes things easier, I can remove the extension from the cell.  These files will always be saved as ".xlsm" files.  below is a table listing the location of the cells where the data will be accessed for this macro, each of these 3 cells resides on a worksheet named "info".  The file used will be a template and then when used each...]]></description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>I have a spreadsheet and I need to be able to create a macro that will do the following:<br />
<br />
create a new subfolder from the value in cell I25 (&quot;info&quot; tab)<br />
The folder needs to be created in an existing directory from the value in cell O8 (&quot;info&quot; tab)<br />
The file needs to be saved in the subfolder just created with the file name that is listed in cell J32 ('info&quot; tab)<br />
<br />
The file name (listed in cell J32) already includes the file extension of &quot;.xlsm&quot;, however if it makes things easier, I can remove the extension from the cell.  These files will always be saved as &quot;.xlsm&quot; files.  below is a table listing the location of the cells where the data will be accessed for this macro, each of these 3 cells resides on a worksheet named &quot;info&quot;.  The file used will be a template and then when used each week the macro will save the template as a name name with all the proper formatting (this is critical as we need to link back to previous files)<br />
<br />
<div class="cms_table"><table width="1000" class="cms_table_grid" align="left"><tr valign="top" class="cms_table_grid_tr"><td class="cms_table_grid_td">cell I25 - Subfolder name</td>
<td class="cms_table_grid_td">05.25.2012</td>
</tr>
<tr valign="top" class="cms_table_grid_tr"><td class="cms_table_grid_td">cell O8 - existing directory</td>
<td class="cms_table_grid_td">X:\Compensation\Hours and Earnings\LV Payroll\BWJ\2012 Payroll\VC Payroll Worksheets 2012\</td>
</tr>
<tr valign="top" class="cms_table_grid_tr"><td class="cms_table_grid_td">cell J32 - file name (with extension)</td>
<td class="cms_table_grid_td">05.25.2012 VC Las Vegas.xlsm</td>
</tr>
</table></div>
</div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>Webbers</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165468</guid>
		</item>
		<item>
			<title>Pivot Tables</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165467&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 19:30:35 GMT</pubDate>
			<description><![CDATA[Hi! 
 
My question is: I am trying to refresh a pivot table and I get an error message "A pivot table cannot overlap another pivot table report". This is a spreadsheet that was passed onto me from another co-worker. To be honest with you I know how to bulid a pivot table but I do not know how to manipulate one.  I read online about macros but I am not sure how to set one up to find the problem and then how to go on and fix it.  
 
Please advise. 
Thank you!]]></description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>Hi!<br />
<br />
My question is: I am trying to refresh a pivot table and I get an error message &quot;A pivot table cannot overlap another pivot table report&quot;. This is a spreadsheet that was passed onto me from another co-worker. To be honest with you I know how to bulid a pivot table but I do not know how to manipulate one.  I read online about macros but I am not sure how to set one up to find the problem and then how to go on and fix it. <br />
<br />
Please advise.<br />
Thank you!</div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>sroe</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165467</guid>
		</item>
		<item>
			<title>Log File</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165466&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 19:09:08 GMT</pubDate>
			<description>Hello, I was desperately needing some help with this.  I want to log changes from a range of cells in sheet 1 lets say A1:A255.  I want those cells to be recorded in sheet 2 to cells A1:A10.  I only want the last 10 changes from sheet 1 to be displayed in sheet 2.  When cell A10 contains data I want cell A1 to be cleared and to start over with the next change.  I have been searching for days for answers.</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>Hello, I was desperately needing some help with this.  I want to log changes from a range of cells in sheet 1 lets say A1:A255.  I want those cells to be recorded in sheet 2 to cells A1:A10.  I only want the last 10 changes from sheet 1 to be displayed in sheet 2.  When cell A10 contains data I want cell A1 to be cleared and to start over with the next change.  I have been searching for days for answers.</div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>jharwood11</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165466</guid>
		</item>
		<item>
			<title>Copy USEDRANGE from closed Workbook to a separate Workbook using VBA</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165465&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 19:00:02 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I feel like I'm almost there.  I have successfully copied the data I need from a closed workbook to a new workbook but I had to specify the exact amount of columns and rows the data is in.  The amount of columns will always be the same (5) but the rows will vary.  I need this to just copy the used range.  Any assistance would be greatly appreciated.   
 
I am using a function along with the sub... I will include them both here.  C=1 to 5 is alright but what can I do instead of r=1 to 11? 
 
<!-- BEGIN TEMPLATE: bbcode_code --> 
<div class="bbcode_container"> 
	<div class="bbcode_description">VB:</div> 
	<pre class="bbcode_code"style="height:1212px;"><span class="keyword">Private</span> <span class="keyword">Function</span> GetValue(path, file, sheet, ref)]]></description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>Hi,<br />
<br />
I feel like I'm almost there.  I have successfully copied the data I need from a closed workbook to a new workbook but I had to specify the exact amount of columns and rows the data is in.  The amount of columns will always be the same (5) but the rows will vary.  I need this to just copy the used range.  Any assistance would be greatly appreciated.  <br />
<br />
I am using a function along with the sub... I will include them both here.  C=1 to 5 is alright but what can I do instead of r=1 to 11?<br />
<br />
<!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div class="bbcode_container">
	<div class="bbcode_description">VB:</div>
	<hr /><code class="bbcode_code"><span class="keyword">Private</span> <span class="keyword">Function</span> GetValue(path, file, sheet, ref)<br /> 
    <br /> 
     <span class="comment">'Retrieves a value from a closed workbook<br /></span>
    &nbsp; &nbsp; <span class="keyword">Dim</span> arg <span class="keyword">As</span> String<br /> 
    &nbsp; &nbsp; <br /> 
     <span class="comment">'Make sure the file exists<br /></span>
    &nbsp; &nbsp; <span class="keyword">If</span> Right(path, 1) &lt;&gt; "\" <span class="keyword">Then</span> path = path &amp; "\"<br /> 
    &nbsp; &nbsp; &nbsp; <span class="keyword">If</span> Dir(path &amp; file) = "" Then<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; GetValue = "File Not Found"<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; Exit Function<br /> 
    &nbsp; &nbsp; <span class="keyword">End</span> If<br /> 
    &nbsp; &nbsp; <br /> 
     <span class="comment">'Create the argument<br /></span>
    &nbsp; &nbsp; arg = "'" &amp; path &amp; "&#91;" &amp; file &amp; "&#93;" &amp; sheet &amp; "'!" &amp; _<br /> 
    &nbsp; &nbsp; &nbsp; Range(ref).Range("A1").Address(, , xlR1C1)<br /> 
    &nbsp; &nbsp; &nbsp; <br /> 
     <span class="comment">'Execute an XLM macro<br /></span>
    &nbsp; &nbsp; GetValue = ExecuteExcel4Macro(arg)<br /> 
    &nbsp; &nbsp; <br /> 
<span class="keyword">End</span> Function<br /> 
<br /> 
<span class="keyword">Sub</span> TrainingSummary()<br /> 
    <br /> 
     <span class="comment">'Turn off screen updating<br /></span>
    <br /> 
    &nbsp; Application.ScreenUpdating = False<br /> 
    &nbsp; <br /> 
     <span class="comment">'clear all contents on summary page<br /></span>
    &nbsp; &nbsp; &nbsp; &nbsp; <br /> 
    &nbsp; &nbsp; Sheet1.Cells.ClearContents<br /> 
    <br /> 
     <span class="comment">'Pull data from closed workbook<br /></span>
    <br /> 
    &nbsp; &nbsp; p = "C:\Documents and Settings\jperry000\Desktop\Megan Training Project"<br /> 
    &nbsp; &nbsp; f = "East Local Training.xlsm"<br /> 
    &nbsp; &nbsp; s = "Summary"<br /> 
    &nbsp; &nbsp; &nbsp; <br /> 
    &nbsp; &nbsp; &nbsp;  <span class="keyword">For</span> r = 1 <span class="keyword">To</span> 11<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <span class="keyword">For</span> c = 1 <span class="keyword">To</span> 5<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  a = Cells(r, c).Address<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cells(r, c) = GetValue(p, f, s, a)<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; <span class="keyword">Next</span> c<br /> 
    &nbsp; &nbsp; &nbsp;  <span class="keyword">Next</span> r<br /> 
    &nbsp; &nbsp; <br /> 
     <span class="comment">'Change width, height, text alignment for entire sheet<br /></span>
    <br /> 
    &nbsp; &nbsp; Sheet1.Select<br /> 
    &nbsp; &nbsp; Cells.Select<br /> 
    &nbsp; &nbsp; <span class="keyword">With</span> Selection<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; .HorizontalAlignment = xlCenter<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; .VerticalAlignment = xlCenter<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; .WrapText = False<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; .Orientation = 0<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; .AddIndent = False<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; .IndentLevel = 0<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; .ShrinkToFit = False<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; .ReadingOrder = xlContext<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; .MergeCells = False<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; .RowHeight = 20<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; .ColumnWidth = 25<br /> 
    &nbsp; &nbsp; <span class="keyword">End</span> With<br /> 
    &nbsp; &nbsp; <br /> 
     <span class="comment">'Change width of column if 'Training' is the header<br /></span>
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; <span class="keyword">For</span> i = 5 <span class="keyword">To</span> 1 <span class="keyword">Step</span> -1<br /> 
    <br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="keyword">If</span> Application.WorksheetFunction.CountIf(Columns(i), "Training") &gt; 0 Then<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Columns(i).ColumnWidth = 40<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="keyword">End</span> If<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; <span class="keyword">Next</span> i<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; <br /> 
     <span class="comment">'width, height, and text alignment for row1 only<br /></span>
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; Rows("1:1").Select<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="keyword">With</span> Selection<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .RowHeight = 40<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .WrapText = True<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Font.Bold = True<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="keyword">End</span> With<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> 
    &nbsp; <span class="comment">'Freeze top row<br /></span>
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> 
    &nbsp; &nbsp; &nbsp; &nbsp;  ActiveWindow.FreezePanes = False<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> 
    &nbsp; &nbsp; &nbsp; &nbsp;  <span class="keyword">With</span> ActiveWindow<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .SplitColumn = 0<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .SplitRow = 1<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; <span class="keyword">End</span> With<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ActiveWindow.FreezePanes = True<br /> 
    <br /> 
     <span class="comment">'scroll to the top and select first cell<br /></span>
    <br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; ActiveWindow.ScrollRow = 1<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; Cells(1, 1).Select<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; <br /> 
     <span class="comment">'check for autofilter<br /></span>
    &nbsp; &nbsp;  <br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="keyword">If</span> <span class="keyword">Not</span> ActiveSheet.AutoFilterMode Then<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ActiveSheet.Range("A1").AutoFilter<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="keyword">End</span> If<br /> 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> 
    &nbsp; &nbsp; <br /> 
     <span class="comment">'Turn on screen updating<br /></span>
    &nbsp; &nbsp; Application.ScreenUpdating = True<br /> 
    &nbsp; &nbsp; <br /> 
<span class="keyword">End Sub</span> 

</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>jeff5019</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165465</guid>
		</item>
		<item>
			<title>How do I run a Private Sub Worksheet_Change(ByVal Target As Range) Macro??</title>
			<link>http://www.ozgrid.com/forum/showthread.php?t=165464&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 18:23:39 GMT</pubDate>
			<description><![CDATA[I am using a Macro (written in Module 1) to take what is entered in Cell A1 and name the report with the data in that cell. However, I can not find the Macro when I open the lists of Macros, presumably because it is Private. What do I need to do to run this function or get it to work. I've seen posts that said a code needs to be created to call this Macro. I have tried to replicate this with no success. Below is the data I have in Module 1. It is all I have added into VBA. Obviously, I am new to VBA so any help would be greatly appreciated.  
 
<!-- BEGIN TEMPLATE: bbcode_code --> 
<div class="bbcode_container"> 
	<div class="bbcode_description">VB:</div> 
	<pre class="bbcode_code"style="height:636px;"><span class="keyword">Private</span> <span class="keyword">Sub</span>...]]></description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>I am using a Macro (written in Module 1) to take what is entered in Cell A1 and name the report with the data in that cell. However, I can not find the Macro when I open the lists of Macros, presumably because it is Private. What do I need to do to run this function or get it to work. I've seen posts that said a code needs to be created to call this Macro. I have tried to replicate this with no success. Below is the data I have in Module 1. It is all I have added into VBA. Obviously, I am new to VBA so any help would be greatly appreciated. <br />
<br />
<!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div class="bbcode_container">
	<div class="bbcode_description">VB:</div>
	<hr /><code class="bbcode_code"><span class="keyword">Private</span> <span class="keyword">Sub</span> Worksheet_Change(<span class="keyword">ByVal</span> Target <span class="keyword">As</span> Excel.Range)<br /> 
    <span class="keyword">Dim</span> Path <span class="keyword">As</span> <span class="keyword">String</span> <span class="comment">' path of current worksheet<br /></span>
    <span class="keyword">Dim</span> ThisFileNew <span class="keyword">As</span> <span class="keyword">String</span> <span class="comment">' new file name including path<br /></span>
    <span class="keyword">Dim</span> Resp <span class="keyword">As</span> <span class="keyword">Integer</span> <span class="comment">' user response to overwrite query<br /></span>
    <span class="keyword">Dim</span> i <span class="keyword">As</span> Integer<br /> 
    <span class="keyword">Dim</span> fname <span class="keyword">As</span> String<br /> 
    fname = ActiveWorkbook.FullName<br /> 
    <span class="keyword">If</span> Target = Range("AI1") Then<br /> 
    <span class="keyword">For</span> i = 1 <span class="keyword">To</span> Worksheets.Count<br /> 
        Worksheets(i).Name = Target.Value + i - 1<br /> 
        Next<br /> 
    <span class="keyword">End</span> If<br /> 
    <span class="keyword">If</span> <span class="keyword">Not</span> Intersect(Target(1), Range("A1")) <span class="keyword">Is</span> <span class="keyword">Nothing</span> Then<br /> 
    <span class="keyword">With</span> Application<br /> 
        .EnableEvents = False<br /> 
        .DisplayAlerts = False<br /> 
    <span class="keyword">End</span> With<br /> 
    On Error Resume Next<br /> 
     <span class="comment">' Set cell contents (file name) to upper case<br /></span>
    Target.Value = UCase(Target.Text)<br /> 
     <span class="comment">' Get current path (empty if workbook has never been saved)<br /></span>
    Path = ThisWorkbook.Path<br /> 
    <span class="keyword">If</span> <span class="keyword">Not</span> Path = "" <span class="keyword">Then</span> Path = Path &amp; ""<br /> 
    ThisFileNew = Path &amp; Target.Text &amp; ".xls"<br /> 
    Resp = vbOK<br /> 
     <span class="comment">' Check for existing file of same name and, if present, ask whether to overwrite<br /></span>
    <span class="keyword">With</span> Application.FileSearch<br /> 
        .NewSearch<br /> 
        .LookIn = ThisWorkbook.Path<br /> 
        .SearchSubFolders = False<br /> 
        .Filename = Target.Text &amp; ".xls"<br /> 
        .MatchTextExactly = False<br /> 
        .FileType = msoFileTypeAllFiles<br /> 
        <span class="keyword">If</span> .Execute() &gt; 0 Then<br /> 
        Resp = MsgBox("This file already exists. Overwrite? ", vbExclamation + vbOKCancel)<br /> 
    <span class="keyword">End</span> If<br /> 
<span class="keyword">End</span> With<br /> 
 <span class="comment">' Save the workbook if file does not exist, or if user wants to overwrite it<br /></span>
<span class="keyword">If</span> Resp = vbOK Then<br /> 
ActiveWorkbook.SaveAs Filename:=ThisFileNew<br /> 
Kill fname<br /> 
Else<br /> 
    Resp = MsgBox("You will need to rename this file manually", vbInformation)<br /> 
<span class="keyword">End</span> If<br /> 
<span class="keyword">On Error Goto</span> 0<br /> 
<span class="keyword">With</span> Application<br /> 
    .DisplayAlerts = True<br /> 
    .EnableEvents = True<br /> 
<span class="keyword">End</span> With<br /> 
<span class="keyword">End</span> If<br /> 
<span class="keyword">End Sub</span> 

</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.ozgrid.com/forum/forumdisplay.php?f=8">EXCEL HELP</category>
			<dc:creator>brooke</dc:creator>
			<guid isPermaLink="true">http://www.ozgrid.com/forum/showthread.php?t=165464</guid>
		</item>
	</channel>
</rss>

