Greg Truby
MrExcel MVP
- Joined
- Jun 19, 2002
- Messages
- 10,030
Just testing various monospaced fonts (the test forum has HTML turned off; otherwise I'd use that).
Testing Calibri versus Verdana and various monospace fonts:
<hr /><h2>Calibri</h2><hr />
<font face=Calibri><SPAN style="color:#00007F">Private</SPAN> m_celTarget <SPAN style="color:#00007F">As</SPAN> Excel.Range<br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_KeyPress(<SPAN style="color:#00007F">ByVal</SPAN> KeyAscii As MSForms.ReturnInteger)<br><br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> <br> <SPAN style="color:#00007F">If</SPAN> ActiveCell.Column > 7 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = ActiveCell<br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Range("A" & Rows.Count).End(xlUp)<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Cells(m_celTarget.Row, Columns.Count).End(xlToLeft)<br> <br> <SPAN style="color:#00007F">If</SPAN> Len(m_celTarget.Value) <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> m_celTarget.Value = Chr(KeyAscii)<br> <br> TextBox1.Text = ""<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">Else</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_LostFocus()<br><br> TextBox1.Text = ""<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = <SPAN style="color:#00007F">Nothing</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
<hr /><h2>Verdanda</h2><hr />
<font face=Verdana><SPAN style="color:#00007F">Private</SPAN> m_celTarget <SPAN style="color:#00007F">As</SPAN> Excel.Range<br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_KeyPress(<SPAN style="color:#00007F">ByVal</SPAN> KeyAscii As MSForms.ReturnInteger)<br><br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> <br> <SPAN style="color:#00007F">If</SPAN> ActiveCell.Column > 7 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = ActiveCell<br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Range("A" & Rows.Count).End(xlUp)<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Cells(m_celTarget.Row, Columns.Count).End(xlToLeft)<br> <br> <SPAN style="color:#00007F">If</SPAN> Len(m_celTarget.Value) <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> m_celTarget.Value = Chr(KeyAscii)<br> <br> TextBox1.Text = ""<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">Else</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_LostFocus()<br><br> TextBox1.Text = ""<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = <SPAN style="color:#00007F">Nothing</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
<hr /><h2>Courier New</h2><hr />
<font face="Courier New"><SPAN style="color:#00007F">Private</SPAN> m_celTarget <SPAN style="color:#00007F">As</SPAN> Excel.Range<br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_KeyPress(<SPAN style="color:#00007F">ByVal</SPAN> KeyAscii As MSForms.ReturnInteger)<br><br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> <br> <SPAN style="color:#00007F">If</SPAN> ActiveCell.Column > 7 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = ActiveCell<br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Range("A" & Rows.Count).End(xlUp)<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Cells(m_celTarget.Row, Columns.Count).End(xlToLeft)<br> <br> <SPAN style="color:#00007F">If</SPAN> Len(m_celTarget.Value) <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> m_celTarget.Value = Chr(KeyAscii)<br> <br> TextBox1.Text = ""<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">Else</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_LostFocus()<br><br> TextBox1.Text = ""<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = <SPAN style="color:#00007F">Nothing</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
<hr /><h2>Lucida Sans Typewriter</h2><hr />
<font face="Lucida Sans Typewriter"><SPAN style="color:#00007F">Private</SPAN> m_celTarget <SPAN style="color:#00007F">As</SPAN> Excel.Range<br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_KeyPress(<SPAN style="color:#00007F">ByVal</SPAN> KeyAscii As MSForms.ReturnInteger)<br><br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> <br> <SPAN style="color:#00007F">If</SPAN> ActiveCell.Column > 7 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = ActiveCell<br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Range("A" & Rows.Count).End(xlUp)<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Cells(m_celTarget.Row, Columns.Count).End(xlToLeft)<br> <br> <SPAN style="color:#00007F">If</SPAN> Len(m_celTarget.Value) <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> m_celTarget.Value = Chr(KeyAscii)<br> <br> TextBox1.Text = ""<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">Else</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_LostFocus()<br><br> TextBox1.Text = ""<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = <SPAN style="color:#00007F">Nothing</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
<hr /><h2>Consolas</h2><hr />
<font face=Consolas><SPAN style="color:#00007F">Private</SPAN> m_celTarget <SPAN style="color:#00007F">As</SPAN> Excel.Range<br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_KeyPress(<SPAN style="color:#00007F">ByVal</SPAN> KeyAscii As MSForms.ReturnInteger)<br><br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> <br> <SPAN style="color:#00007F">If</SPAN> ActiveCell.Column > 7 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = ActiveCell<br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Range("A" & Rows.Count).End(xlUp)<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Cells(m_celTarget.Row, Columns.Count).End(xlToLeft)<br> <br> <SPAN style="color:#00007F">If</SPAN> Len(m_celTarget.Value) <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> m_celTarget.Value = Chr(KeyAscii)<br> <br> TextBox1.Text = ""<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">Else</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_LostFocus()<br><br> TextBox1.Text = ""<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = <SPAN style="color:#00007F">Nothing</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
<hr /><h2>Lucida Console</h2><hr />
<font face="Lucida Console"><SPAN style="color:#00007F">Private</SPAN> m_celTarget <SPAN style="color:#00007F">As</SPAN> Excel.Range<br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_KeyPress(<SPAN style="color:#00007F">ByVal</SPAN> KeyAscii As MSForms.ReturnInteger)<br><br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> <br> <SPAN style="color:#00007F">If</SPAN> ActiveCell.Column > 7 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = ActiveCell<br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Range("A" & Rows.Count).End(xlUp)<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Cells(m_celTarget.Row, Columns.Count).End(xlToLeft)<br> <br> <SPAN style="color:#00007F">If</SPAN> Len(m_celTarget.Value) <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> m_celTarget.Value = Chr(KeyAscii)<br> <br> TextBox1.Text = ""<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">Else</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_LostFocus()<br><br> TextBox1.Text = ""<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = <SPAN style="color:#00007F">Nothing</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
Testing Calibri versus Verdana and various monospace fonts:
<hr /><h2>Calibri</h2><hr />
<font face=Calibri><SPAN style="color:#00007F">Private</SPAN> m_celTarget <SPAN style="color:#00007F">As</SPAN> Excel.Range<br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_KeyPress(<SPAN style="color:#00007F">ByVal</SPAN> KeyAscii As MSForms.ReturnInteger)<br><br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> <br> <SPAN style="color:#00007F">If</SPAN> ActiveCell.Column > 7 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = ActiveCell<br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Range("A" & Rows.Count).End(xlUp)<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Cells(m_celTarget.Row, Columns.Count).End(xlToLeft)<br> <br> <SPAN style="color:#00007F">If</SPAN> Len(m_celTarget.Value) <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> m_celTarget.Value = Chr(KeyAscii)<br> <br> TextBox1.Text = ""<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">Else</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_LostFocus()<br><br> TextBox1.Text = ""<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = <SPAN style="color:#00007F">Nothing</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
<hr /><h2>Verdanda</h2><hr />
<font face=Verdana><SPAN style="color:#00007F">Private</SPAN> m_celTarget <SPAN style="color:#00007F">As</SPAN> Excel.Range<br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_KeyPress(<SPAN style="color:#00007F">ByVal</SPAN> KeyAscii As MSForms.ReturnInteger)<br><br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> <br> <SPAN style="color:#00007F">If</SPAN> ActiveCell.Column > 7 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = ActiveCell<br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Range("A" & Rows.Count).End(xlUp)<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Cells(m_celTarget.Row, Columns.Count).End(xlToLeft)<br> <br> <SPAN style="color:#00007F">If</SPAN> Len(m_celTarget.Value) <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> m_celTarget.Value = Chr(KeyAscii)<br> <br> TextBox1.Text = ""<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">Else</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_LostFocus()<br><br> TextBox1.Text = ""<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = <SPAN style="color:#00007F">Nothing</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
<hr /><h2>Courier New</h2><hr />
<font face="Courier New"><SPAN style="color:#00007F">Private</SPAN> m_celTarget <SPAN style="color:#00007F">As</SPAN> Excel.Range<br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_KeyPress(<SPAN style="color:#00007F">ByVal</SPAN> KeyAscii As MSForms.ReturnInteger)<br><br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> <br> <SPAN style="color:#00007F">If</SPAN> ActiveCell.Column > 7 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = ActiveCell<br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Range("A" & Rows.Count).End(xlUp)<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Cells(m_celTarget.Row, Columns.Count).End(xlToLeft)<br> <br> <SPAN style="color:#00007F">If</SPAN> Len(m_celTarget.Value) <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> m_celTarget.Value = Chr(KeyAscii)<br> <br> TextBox1.Text = ""<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">Else</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_LostFocus()<br><br> TextBox1.Text = ""<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = <SPAN style="color:#00007F">Nothing</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
<hr /><h2>Lucida Sans Typewriter</h2><hr />
<font face="Lucida Sans Typewriter"><SPAN style="color:#00007F">Private</SPAN> m_celTarget <SPAN style="color:#00007F">As</SPAN> Excel.Range<br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_KeyPress(<SPAN style="color:#00007F">ByVal</SPAN> KeyAscii As MSForms.ReturnInteger)<br><br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> <br> <SPAN style="color:#00007F">If</SPAN> ActiveCell.Column > 7 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = ActiveCell<br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Range("A" & Rows.Count).End(xlUp)<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Cells(m_celTarget.Row, Columns.Count).End(xlToLeft)<br> <br> <SPAN style="color:#00007F">If</SPAN> Len(m_celTarget.Value) <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> m_celTarget.Value = Chr(KeyAscii)<br> <br> TextBox1.Text = ""<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">Else</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_LostFocus()<br><br> TextBox1.Text = ""<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = <SPAN style="color:#00007F">Nothing</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
<hr /><h2>Consolas</h2><hr />
<font face=Consolas><SPAN style="color:#00007F">Private</SPAN> m_celTarget <SPAN style="color:#00007F">As</SPAN> Excel.Range<br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_KeyPress(<SPAN style="color:#00007F">ByVal</SPAN> KeyAscii As MSForms.ReturnInteger)<br><br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> <br> <SPAN style="color:#00007F">If</SPAN> ActiveCell.Column > 7 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = ActiveCell<br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Range("A" & Rows.Count).End(xlUp)<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Cells(m_celTarget.Row, Columns.Count).End(xlToLeft)<br> <br> <SPAN style="color:#00007F">If</SPAN> Len(m_celTarget.Value) <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> m_celTarget.Value = Chr(KeyAscii)<br> <br> TextBox1.Text = ""<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">Else</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_LostFocus()<br><br> TextBox1.Text = ""<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = <SPAN style="color:#00007F">Nothing</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
<hr /><h2>Lucida Console</h2><hr />
<font face="Lucida Console"><SPAN style="color:#00007F">Private</SPAN> m_celTarget <SPAN style="color:#00007F">As</SPAN> Excel.Range<br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_KeyPress(<SPAN style="color:#00007F">ByVal</SPAN> KeyAscii As MSForms.ReturnInteger)<br><br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> <br> <SPAN style="color:#00007F">If</SPAN> ActiveCell.Column > 7 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = ActiveCell<br> <br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Range("A" & Rows.Count).End(xlUp)<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Cells(m_celTarget.Row, Columns.Count).End(xlToLeft)<br> <br> <SPAN style="color:#00007F">If</SPAN> Len(m_celTarget.Value) <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> m_celTarget.Value = Chr(KeyAscii)<br> <br> TextBox1.Text = ""<br> <br> <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br> <SPAN style="color:#00007F">Else</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_LostFocus()<br><br> TextBox1.Text = ""<br> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = <SPAN style="color:#00007F">Nothing</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
Last edited: