Thread: cell select
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ranswert ranswert is offline
external usenet poster
 
Posts: 161
Default cell select

Also, is there a way to make this procedure shorter? It's a little slow.
Maybe there is a faster way to make it work.

"ranswert" wrote:

I have written the following procedu

Sub addestimateitem()
Dim cboxno, itemno As Integer
unprotectsheet
itemno = ActiveSheet.Range("estitemnum") + 1
Range("estitemnum").Value = itemno
cboxno = ActiveSheet.Range("estcboxnum") + 1
Range("estcboxnum").Value = cboxno
Range("esttotal").Select
ActiveCell.Offset(itemno, 0).Name = "esttotalamt"
Range("estno").Select
ActiveCell.Offset(itemno, 0).Select
Selection.EntireRow.Insert
ActiveCell.Value = itemno
Range(ActiveCell.Offset(0, 2), ActiveCell.Offset(0, 3)).Select
mergecells
Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 2)).Select
mergecells
ActiveCell.EntireRow.Cells(11).Value = cboxno
ActiveCell.Offset(0, -4).Select
Selection.RowHeight = 12.75
Selection.Font.Bold = False
Selection.Font.Size = 10
Range(ActiveCell.Offset(0, 2), ActiveCell.Offset(0, 5)).Select
Selection.Font.Bold = False
Range(ActiveCell.Offset(0, -2), ActiveCell.Offset(0, 4)).Select
addborders
ActiveCell.Offset(0, 1).Select
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 3)).Select
Selection.Locked = False
Range(ActiveCell.Offset(0, 3), ActiveCell.Offset(0, 4)).Select
Selection.NumberFormat = "$#,##0.00_);[Red]($#,##0.00)"
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "=IF(RC[2],RC[-1],0)"
ActiveCell.Offset(0, -6).Select
addcheckbox
Range("esttotal").Select
Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(itemno, 0)).Select
Selection.Name = "esttotalscol"
Range("esttotalamt").Select
Selection.NumberFormat = "$#,##0.00_);[Red]($#,##0.00)"
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
ActiveCell.FormulaR1C1 = "=sum(esttotalscol)"
Range("estsubven").Select
ActiveCell.Offset(itemno, 0).Select
protectsheet


End Sub

When the procedure is done and i press the enter key the curser move up a
few rows and over one column instead of moving to the right one column. I
have the settings set for the curser to move to the right when it is pressed.
If I don't have the sheet protected it moves to the right. The cells are
not locked either. What do I need to do to get it to move right?
Thanks