Thread: Help-Simple Sub
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Peo Sjoblom Peo Sjoblom is offline
external usenet poster
 
Posts: 3,268
Default Help-Simple Sub

Tom forgot a parenthesis in this line

for each cell in sh2.Range("A2:C2" _

should be

for each cell in sh2.Range("A2:C2") _

--
Regards,

Peo Sjoblom

(No private emails please)


"New to VBA" wrote
in message ...

Tom,
Thanks for the advice. I tried as shown below, but I receive a compile
error,syntax error message. Any thoughts? Thanks.

Sub AddCells1()
Dim sh1 As Worksheet, sh2 As Worksheet
Dim cell As Range
Set sh1 = Worksheets("Sheet1")
Set sh2 = Worksheets("Sheet2")
for each cell in sh2.Range("A2:C2" _
cell.Value = cell.Value + sh1.Cells(1,cell.column).Value
Next
End Sub


--
New to VBA
------------------------------------------------------------------------
New to VBA's Profile:
http://www.excelforum.com/member.php...o&userid=30032
View this thread: http://www.excelforum.com/showthread...hreadid=497191