Javascript to Access Excel Cell Range

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
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,224,847
Messages
6,181,330
Members
453,032
Latest member
Pauh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top