Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CELLS RANGE 1

Status
Not open for further replies.

ram567

Programmer
Dec 28, 2007
123
US
HI!
THE BELOW CODE WITH END WITH HAS SYNTAX ERROR. COULD YOU TELL ME WHAT IS THE ERROR?
THANKS IN ADVANCE

with obj.Worksheets("Sheet1").select
obj.Worksheets("Sheet1").Cells("1:4").Font.Size = 12
obj.Worksheets("Sheet1") .Range("1:4") = "x";"Y";"Z";"B"
End with

OR

obj.Worksheets("Sheet1").Cells(1,1).Font.Size = 12
obj.Worksheets("Sheet1").Cells(1,1)= "X"
obj.Worksheets("Sheet1").Cells(1,2)= "Y"
obj.Worksheets("Sheet1").Cells(1,3)= "Z"
obj.Worksheets("Sheet1").Cells(1,4)= "B"


 

Code:
with obj.Worksheets("Sheet1")[red][s].select[/s][/red]
   [red].Cells("1:4")[/red].Font.Size = 12
   [red].Range("1:4")[/red] = "x";"Y";"Z";"B"
End with
the syntax is
Code:
  .Cells(somerow, somecol)
  .Range("somecellref:anothercellref")
like
Code:
  .Cells(5, 2)
  .Range("B7:D9")
Now it looks as if you wanted to do something like this...
Code:
with obj.Worksheets("Sheet1")
  with .Cells(1,1)
    .Font.Size = 12
    .value = "X"
  end with
  .Cells(1,2).value = "Y"
  .Cells(1,3).value = "Z"
  .Cells(1,4).value = "B"
end with


Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top