Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Strange macro problem

  Asked By: Seth    Date: Nov 24    Category: MS Office    Views: 622
  

I'll call this macro from a macro running in "sheet 1"

Is it something wrong with the way I select/move to " sheet 4 " ?

Sub nySkytter() '(nyttNavn, nyStatus)
nyttNavn = "Pelle Parafin"
nyStatus = "g"

Sheets("4").Select 'If standing in sheet 1 when running this
mac. Here it fails.

'ActiveSheet.Range("Skyttere").Select 'If standing in sheet
4 , using this line ,when running this mac. This will fail.

varNbRows = Selection.Rows.Count + 1 '(+1)Flytter til 1.
ledige plass
Range("A1").Offset(varNbRows - 1, 0).Select 'Runtime
Error:1004....select metode of range class failed
'I want to move to the first free cell in "A"
'Then fill col A,E,F

ActiveCell = nyttNavn 'Col "A"
ActiveCell.Offset(0, 4) = nyStatus 'Col "E"
ActiveCell.Offset(0, 5) = betalt 'Col "F"

End Sub

I'll have this feeling that it could be done in a more nice way.

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Strange macro problem Or get search suggestion and latest updates.




Tagged: