• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting from Cell to Cell in excel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting from Cell to Cell in excel


  • Subject: Re: Getting from Cell to Cell in excel
  • From: Walter Ian Kaye <email@hidden>
  • Date: Fri, 23 Jul 2004 12:43:34 -0700

At 01:45p -0400 07/23/2004, Jeff Lambert didst inscribe upon an electronic papyrus:

I want to be able to get the font of a cell, then change it to another font,
then move on to the next until all Cell are done in a Sheet.

You don't need to physically move from cell to cell (select range); you can tell Excel to operate on a range other than the currently active cell.

I get the part of checking the font and changing it if it9s this or that
font, but I can only do it on a specific cell, not automaticly.

You have to do what I did, which was to scan through xl's dictionary to see how to get the beginning and ending rows and columns, after which you can loop through and concatenate to form a reference to the current cell.
In the process I discovered that UsedRange doesn't bother defaulting to the active worksheet, so I had to specify it. You may run into inconsistencies like that; such is life!

I9m new to applescript so be patient with me please:-)

OK, try this:

tell app "Microsoft Excel"
set bCell to Cell 1 of UsedRange of Worksheet 1
set eCell to Cell -1 of UsedRange of Worksheet 1
set {bRow, eRow} to {Row of bCell, Row of eCell}
set {bCol, eCol} to {Column of bCell, Column of eCell}
repeat with iRow from bRow to eRow
repeat with iCol from bCol to eCol
set curCell to Range ("R" & iRow & "C" & iCol)
if Name of Font of Selection is "ConduitArdoise-Medium" then
set Name of Font of Selection to "Conduit ITC Medium"
else if Name of Font of Selection is "ConduitArdoise-Bold" then
set Name of Font of Selection to "Conduit ITC bold"
else if Name of Font of Selection is "ConduitArdoise" then
set Name of Font of Selection to "Conduit ITC"
else if Name of Font of Selection is "ConduitArdoise-Italic" then
set Name of Font of Selection to "Conduit ITC italic"
else
-- we ignore any unspecified fonts
end if
end repeat
end repeat
end tell
beep


It's a bit slow, but you can always do something else while it chugs away. ;)


-boo
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Getting from Cell to Cell in excel (From: Jeff Lambert <email@hidden>)

  • Prev by Date: RE: Change mode in Photoshop
  • Next by Date: Re: Getting from Cell to Cell in excel
  • Previous by thread: Re: Getting from Cell to Cell in excel
  • Next by thread: Re: Getting from Cell to Cell in excel
  • Index(es):
    • Date
    • Thread