G
Guest
All,
I am moving the formatting (border, font, cell size, etc) from a cell on one
sheet to a cell on another sheet by using copy and PasteSpecial. It works
fine except there are is a cell that does not get the borders copied. It
consistantly does not copy the borders from cell $K$13.
The code searches the worksheet looking for cells that contain the "<"
character. If it finds one, it copies the formatting to Sheet 1 to Sheet 2.
Here is the code I am using:
objBook = objBooks.Open(objReport.TemplateFileName)
objSheets = objBook.Worksheets()
objSheet = objSheets.Item(1)
objSheet2 = objSheets.Item(2)
objSheet.Name = "Unit Price"
' Look for TAGs in the Template
For I = 1 To 20
For J = 1 To 80
sTemp1 = Convert.ToChar(I + 64) & J.ToString
sTemp2 = objSheet.Range(sTemp1).Value
If Not IsNothing(sTemp2) Then
If sTemp2.Substring(0, 1) = "<" Then
sTag = sTemp2.Substring(1, sTemp2.Length - 2)
range = objSheet.Range(sTemp1)
sTemp3 =
objSheet.Range(sTemp1).MergeArea.Address()
sTemp1 = sTemp3
objSheet.Range(sTemp1).Copy()
objSheet2.Range(sTemp1).PasteSpecial(Microsoft.Office.Interop.Excel.XlPasteType.xlPasteAll)
End If
End If
Next
Next
I am totally stumped!!!
Thanks for your help.
I am moving the formatting (border, font, cell size, etc) from a cell on one
sheet to a cell on another sheet by using copy and PasteSpecial. It works
fine except there are is a cell that does not get the borders copied. It
consistantly does not copy the borders from cell $K$13.
The code searches the worksheet looking for cells that contain the "<"
character. If it finds one, it copies the formatting to Sheet 1 to Sheet 2.
Here is the code I am using:
objBook = objBooks.Open(objReport.TemplateFileName)
objSheets = objBook.Worksheets()
objSheet = objSheets.Item(1)
objSheet2 = objSheets.Item(2)
objSheet.Name = "Unit Price"
' Look for TAGs in the Template
For I = 1 To 20
For J = 1 To 80
sTemp1 = Convert.ToChar(I + 64) & J.ToString
sTemp2 = objSheet.Range(sTemp1).Value
If Not IsNothing(sTemp2) Then
If sTemp2.Substring(0, 1) = "<" Then
sTag = sTemp2.Substring(1, sTemp2.Length - 2)
range = objSheet.Range(sTemp1)
sTemp3 =
objSheet.Range(sTemp1).MergeArea.Address()
sTemp1 = sTemp3
objSheet.Range(sTemp1).Copy()
objSheet2.Range(sTemp1).PasteSpecial(Microsoft.Office.Interop.Excel.XlPasteType.xlPasteAll)
End If
End If
Next
Next
I am totally stumped!!!
Thanks for your help.