Help with a couple lines of code

  • Thread starter Thread starter Matthew
  • Start date Start date
M

Matthew

I am using an excel automation module. the following two
lines i'm not sure how i can manipulate it.

With objActiveWkb
..Worksheets(1).Cells(1, 2) = .Worksheets(1).Cells(1, 1)
strWhat = .Worksheets(1).Cells(1, 1).Value
End With

I'm not sure what these two lines mean. For instance,
would i be able to change this to say Cells(A1) = the
value in Cell(A2)
so ending result would be cell A1 and A2 had identicle
values. Any help would be terrific. Thankyou. Matthew
 
Try

.Worksheets(1).Cells(1, 1).Value = .Worksheets(1).Cells(2, 1).Value

alternatively

.Worksheets(1).Range("A1").Value = .Worksheets(1).Range("A2").Value

Beware the use of default properties.
 
Thanks alot! this worked perfectly.
-----Original Message-----
Try

.Worksheets(1).Cells(1, 1).Value = .Worksheets (1).Cells(2, 1).Value

alternatively

.Worksheets(1).Range("A1").Value = .Worksheets (1).Range("A2").Value

Beware the use of default properties.
 
Back
Top