Thread: object required
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default object required

Cells(1, "d").Value = txtheading.Text

You are trying to put something in cell D1 that has not been defined in this
procedure.
txtheading appears to be a variable, but unless it is made a global variable
its value will not be picked up by a procedure that is private. The options
are to make it a global variable or to define it within this procedure.




"kyle" wrote in message
...

i copied this from a book. i run the macro and it says object required.
what's up?

Private Sub cmdinsertheading_click()
Cells(1, "d").Value = txtheading.Text
Cells(1, "d").Select

With Selection
.Font.Bold = True
.Font.Name = "arial"
.Font.Size = 72
.Font.Color = RGB(0, 0, 255)
.Columns.AutoFit
.Interior.Color = RGB(0, 255, 255)
.Borders.Weight = xlThick
.Borders.Color = RGB(0, 0, 255)
End With

txtheading.Activate

End Sub