Thread: My code fails
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default My code fails

Sub test(mSheet, mVal, mCell)
ActiveWorkbook.Worksheets( _
mSheet).Range(mCell).Value = mVal
End Sub

--
Regards,
Tom Ogilvy


"kirkm" wrote:


Hi,

I'm attemptng the following, to put mVal into any mCell in mSheet


Sub test(mSheet, mVal, mCell)
Dim wk As Workbook
Set wk = ActiveWorkbook
Dim sht As Worksheet
Set sht = wk.Worksheets(mSheet)

With sht
Range(mCell).Select
ActiveCell.Value = mVal
End With
Set sht = Nothing
Set wk = Nothing
End Sub



It doesn't work, but also doesn't report any errors.

It there anything obviously wrong with it?


Thanks - Kirk