Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9046413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:39:28+00:00 2026-06-16T11:39:28+00:00

Problem I have an Excel worksheet with a column of text which is data,

  • 0

Problem

I have an Excel worksheet with a column of text which is data, and some rules in mind for what text values should be formatted with what font and font size.

Specific Example

Cell A1: “Text”

Cells A2 .. (Col. A): strings of text (from a few words to a few sentences) to be optionally formatted with applicable font and font size

Cell B1: “Type of Text”

Cells B2 … (Col. B): single-word strings such as “heading”, “requirement”, “note”

Rules in mind:

If string in Col. B is “heading”, make string in Col. A font size 18

If string in Col. B is “requirement”, make string in Col. A font Calibri

If string in Col. B is “note”, make string in Col. A style “italic”

Constraint

Excel, as a spreadsheet, is all about functional programming (formulas) and parallel processing (recalculation). Yes I can write procedural VBA but, for me it goes against the spirit of spreadsheets (even though procedural programming is so popular that Excel and predecessors have offered that for a long time).

Question

Any ideas on how to do it other than special-purpose VBA procedural programming?

What does not seem to solve

Excel conditional formatting does not solve because it expressly does not allow setting those particular cell attributes.

Excel UDFs (User Defined Functions) do not solve because they do not affect other cells. As expected for functions. And even if I wanted to make a function which duplicates the unformatted text but with a style or size based on value, UDFs do not affect the “environment” – only can return data.

And I found here that I can’t even put VBA code as text in Excel worksheet cells and then evaluate the text as VBA — to make a simple generic VBA procedural processing engine for font style and size VBA statements that I would put in cells in my worksheet.

(If any of this negative information is incorrect, and one of the above will work, please correct me.)

VBA special-purpose, procedural programming example — what works but trying to avoid

Public Sub IterateThroughRangeSetFontStyleSize()

Dim wb As Workbook
Dim ws As Worksheet
Dim rng As Range
Dim cell As Range

Set wb = Application.ActiveWorkbook
Set ws = wb.Worksheets("myWorkSheet")
Set rng = ws.Range("b2", "b4")

For Each cell In rng.Cells
    If LCase(cell.Text) = "bold" Then cell.Offset(0, -1).Font.Bold = True
    If LCase(cell.Text) = "italic" Then cell.Offset(0, -1).Font.Italic = True
    If LCase(cell.Text) = "large" Then cell.Offset(0, -1).Font.Size = 18
Next cell

End Sub

Some ideas that seem too difficult to me but maybe someone will say how they are not

  • Configure Excel to allow VBA to write to VBA editor (VBE), read the worksheet column of data, calculate desired font style and size based on the rules, and autogenerate VBA procedural code to then update the font style and size of the column of data

  • Export or Save As the Excel file as XML, write an XSL style sheet that would format per the rules, open (import?) the XML and tell Excel to use the XSL style sheet

What’s Needed

Some outside-the-box, keep-it-simple thinking!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:39:29+00:00Added an answer on June 16, 2026 at 11:39 am

    It could be possible to keep data and formatting information separately:

    Sheet 1: Data;
    Sheet 2: Function describing the cell formatting for a corresponding cell on Sheet 1 (resulting in bgcolor=”#ff00ff”, font size=”3″ etc.);
    Sheet 3: Data and format merged, giving XSL.

    The only VBA needed is to write one UDF for Sheet 2 and the other one for Sheet 3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Excel worksheet where the user enters certain data, which I want
I have the following problem: I have some Excel-sheets and must export them into
I have a Excel addin that displays some structures on the worksheet. Users can
Ok I have a table on a worksheet which has some columns for some
I have a lot of data in an excel worksheet. For calculations, I would
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
I have created Excel Sheet using Java program. It works fine. My problem is,
I have a big problem. I use excel auto filter function, at the end
Problem: Have made a small mail program which works perfectly on my developer pc
I'm trying to automating some tests for an Excel add-in, which is in xll

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.