output data on range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi! I have problem with writing test to a named range in a different
worksheet than i run the vba code from. I start the code suing a button on a
worksheet and then i want the output on another sheet. however i cannot
manage to get that right.

With Worksheets("Corr. matrix")
ThisWorkbook.Names.Add Name:="OutputCorrMatrix",
RefersTo:="=$a$2:$a$2", Visible:=True
Range("OutputCorrMatrix").Cells(10, 10) = "test"

it is the sheet Corr. matrix that i want the output on but i only manage to
get it on the "start" sheet. pls help me solve this! thanks alot!
 
Anne,

I hope i'm not confused here but if I understand you want to create a named
range on the active sheet called OutputCorrMatrix that refers to A2 and then
write test to J10 on a sheet called Corr. matrix. If thats correct try:-

Sub versive_element()
ThisWorkbook.Names.Add Name:="OutputCorrMatrix", RefersTo:="=$a$2:$a$2"
Worksheets("Corr. matrix").Cells(10, 10) = "test"
End Sub

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top