View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default Excel 2003 VBA problem

On 5/10/2010 1:59 PM, BJ&theBear wrote:
Never used R1C1 notation before and I;m not certain that I understand
it.

The routine below posts a copy of "ProjectID" to the next available
line but am unable to get the VBA macro to save with the R1C2 and R1C3
entries. VBA does not like this - all I was trying to do was post the
three input entries in the first available row in the first three
columns.

Can anyone help or at least point me in the right direction

Thanks

BJthebear

Sub InputNewproject()
'
' InputNewUser Macro
' Macro recorded 01/04/2010 by Brian
'
Dim NewprojectID As String 'ProjectID
Dim Newprojectname As String 'Projectname
Dim Newprojectdescription As String 'Projectdescription
Dim nextRow As Long

NewprojectID = Application.InputBox("Please enter New Project Number
(year first ie 1003)")
Newprojectname = Application.InputBox("Please enter New Project Name")
Newprojectdescription = Application.InputBox("Please enter details of
New Project")

Sheets("ProjectList").Select


'Find last row

Set SrcSht = Sheets("ProjectList")

nextRow = SrcSht.Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1

Application.ScreenUpdating = False


Range("A"& nextRow).Select

ActiveCell.FormulaR1C1 = NewprojectID
Selection.NumberFormat = "@" ' formats number as text

ActiveCell.FormulaR1C2 = Newprojectname
ActiveCell.FormulaR1C3 = Newprojectdescription

' Columns("A:C").Select
'Selection.Sort Key1:=Range("A2"), Order1:=xlAscending,
Header:=xlGuess, _
' OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
' DataOption1:=xlSortNormal
End Sub



Hi. Just to give some alternate ideas:

Cells(NextRow, 1) = NewprojectID
Cells(NextRow, 2) = Newprojectname
Cells(NextRow, 3) = Newprojectdescription

'or
Cells(NextRow, 1).Resize(1, 3) = _
Array(NewprojectID, Newprojectname, Newprojectdescription)


= = = = = = =
HTH :)
Dana DeLouis