Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have this piece of code. The objective is to make a copy of 'Ratings' sheet and transfer all the comments in that sheet as cell values in ' Comments' worksheet ---------------------------------------------------------- Option Explicit Sub Fetch_comment() Dim x, y As Integer Sheets.Add Befo=Worksheets(Worksheets.Count), Type:=xlWorksheet ActiveSheet.Name = "Comments" Worksheets("Ratings").Range("1:2").Copy Destination:= _ Worksheets("Comments").Range("A1") Worksheets("Ratings").Range("A:A").Copy Destination:= _ Worksheets("Comments").Range("A1") For x = 3 To 100 For y = 2 To 156 Worksheets("Comments").Cells(y, x).Value = _ Worksheets("Ratings").Cells(y, x).Comment.Text Next Next End Sub ------------------------------------------------------- There are 2 problems 1)After creating the new sheet, if I use this code Worksheets(Worksheets(Worksheets.Count)).Name = "Comments" for naming the newly created sheet, it gives Error 13- Type mistmatch. Why is it giving that error? 2) It is giving Run Time Error 91- Object Variable or With Block Variable not set at line Worksheets("Comments").Cells(y, x).Value = _ Worksheets("Ratings").Cells(y, x).Comment.Text Please tell me what is the error in this code. TIA Shilps |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Comment Text | Excel Discussion (Misc queries) | |||
Text from a comment box into a cell | Excel Worksheet Functions | |||
Excel Comment Text Box | Excel Discussion (Misc queries) | |||
Search Comment Text | Excel Programming | |||
extract text from a comment | Excel Programming |