View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Max C Max C is offline
external usenet poster
 
Posts: 6
Default Setting the text in a cell to the text of a cell on a different sheet in the same workbook

And dang it! Every time I save and close a workbook with this code in
it, when I reopen the workbook, the change event stops firing. Once
again I don't even get an error message when I change something in
column A. What's the deal?!

Max.


Max C wrote:
OK, getting back in to this. I can't believe this is turning out to be
so hard for me. It's more than a little embarassing. Here's what I
have so far:
__________________________________________________ __________
Private Sub Worksheet_Change(ByVal Target As Range)
Dim SelectedText As String

If Not Intersect(Target, Range("A14:A35")) Is Nothing Then
SelectedText = Sheets("Info").Range("D" & (Target.Value + 24) &
":J" & (Target.Value + 24)).Text
Range("C" & Target.Row & ":I" & Target.Row).Text = SelectedText
End If

End Sub
__________________________________________________ __________

I realize the string variable is unnecessary, but it helps me see it
better. The thing is, the variable assignment line doesn't work. I
get Error 94: Invalid use of Null. Is there no such thing as a Text
property for a range of cells?

By the way, I'm using ranges of cells because in this workbook the 2
ranges holding text are merged cells. When I ran the macro recorder
and selected one of those merged cell blocks, the recorder showed I
selected a range of cells. Maybe that's my problem?

Thanks for looking again.
Max.