aruny2kprasad
New Member
- Joined
- Mar 15, 2005
- Messages
- 2
Hi,
I am trying to write a javascript code to access each cell in a range in Excel and modify the attribute.
VB code is
For Each Acell In Range("A1:C20")
If Acell.Text = "SMITH (4)" Then
Acell.Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
I would like to remove Hyperlink, autoformat and keep the color while removing the hyperlink from the active cell. Please provide the javascript code.
The current code i have is,
function bringToExcel()
{
this.document.execCommand("SelectAll", true);
this.document.execCommand("Copy", true);
this.document.execCommand("UnSelect", false);
this.document.execCommand("Unlink", false);
var xlApp, xlBook, xlSheet;
var Col1, col2, col3;
var oRng1;
xlApp = new ActiveXObject("Excel.Application");
xlApp.Visible = true;
xlBook = xlApp.Workbooks.Add();
xlSheet = xlApp.ActiveSheet;
xlSheet.Paste();
// for (oRng1 in xlSheet.Range("A1", "C20"))
// {
// oRng1.ActiveCell.Interior.ColorIndex = "37";
// oRng1.ActiveCell.Hyperlinks.Delete();
// }
oRng1 = xlSheet.Range("A1", "C20")
oRng1.Font.Bold = true;
oRng1.EntireColumn.AutoFit();
oRng1.Hyperlinks.Delete();
oRng1.Interior.ColorIndex = "37";
xlApp.Visible = true;
xlApp.UserControl = true;
}
Please somebody let me know how to loop at each cell in a range with javascript?
Thank you
Arun
I am trying to write a javascript code to access each cell in a range in Excel and modify the attribute.
VB code is
For Each Acell In Range("A1:C20")
If Acell.Text = "SMITH (4)" Then
Acell.Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
I would like to remove Hyperlink, autoformat and keep the color while removing the hyperlink from the active cell. Please provide the javascript code.
The current code i have is,
function bringToExcel()
{
this.document.execCommand("SelectAll", true);
this.document.execCommand("Copy", true);
this.document.execCommand("UnSelect", false);
this.document.execCommand("Unlink", false);
var xlApp, xlBook, xlSheet;
var Col1, col2, col3;
var oRng1;
xlApp = new ActiveXObject("Excel.Application");
xlApp.Visible = true;
xlBook = xlApp.Workbooks.Add();
xlSheet = xlApp.ActiveSheet;
xlSheet.Paste();
// for (oRng1 in xlSheet.Range("A1", "C20"))
// {
// oRng1.ActiveCell.Interior.ColorIndex = "37";
// oRng1.ActiveCell.Hyperlinks.Delete();
// }
oRng1 = xlSheet.Range("A1", "C20")
oRng1.Font.Bold = true;
oRng1.EntireColumn.AutoFit();
oRng1.Hyperlinks.Delete();
oRng1.Interior.ColorIndex = "37";
xlApp.Visible = true;
xlApp.UserControl = true;
}
Please somebody let me know how to loop at each cell in a range with javascript?
Thank you
Arun