Can You Define a Function for an Entire Column in Excel Using VBA?

  • Thread starter Thread starter cycling4life
  • Start date Start date
  • Tags Tags
    Function
Click For Summary

Discussion Overview

The discussion revolves around the possibility of defining a function for an entire column in Excel using VBA, particularly in the context of handling data imported from a chemical process simulator that inserts blank rows. Participants explore methods to automate formula application across a column based on the values of another column.

Discussion Character

  • Exploratory, Technical explanation, Debate/contested

Main Points Raised

  • One participant asks whether it is possible to define a function for an entire column in Excel, suggesting a need for column B to always reflect a calculation based on column A.
  • Another participant mentions the use of the SUM function as an example of how to perform calculations across a range of cells, although it does not directly address the original query about defining a function for an entire column.
  • A different participant suggests creating a template with the desired VBA function, indicating that this function would be available whenever the template is used to create a new sheet.
  • One participant inquires about the method of data import, asking whether a VBA routine is used or if the import is done manually, and proposes adding a line to the existing VBA routine to update column B with the formula for each row.

Areas of Agreement / Disagreement

Participants express various approaches to the problem, but there is no consensus on a single solution or method to define a function for an entire column in Excel using VBA.

Contextual Notes

Some limitations include the lack of clarity on the specific VBA implementation details and the assumptions regarding the data import process. The discussion does not resolve how to handle the blank rows or the exact nature of the formulas to be applied.

Who May Find This Useful

This discussion may be useful for Excel users, particularly those working with VBA and data import processes, as well as individuals seeking to automate formula applications in spreadsheets.

cycling4life
Messages
7
Reaction score
0
Is it possible to define a function for an entire column in excel? I have data importing from a chemical process simulator and every time it populates a row it will insert a blank row and I need to copy my formulas. Can I make it so, for example, column B is always equal to Column A+something, or etc?
 
Technology news on Phys.org
You can enter =sum(...) into a cell to add up a list of values in a column or row of cells, for example, =sum(a1..a10) produces the sum of the column of cells a1 through a10.
 
Last edited:
Create a template with the VBA function in the template...then use that template to make your sheet each time...that function will be available
 
Do you run a VBA routine to do the import, or manually import a text file, or is another program writing to the .xls file?

If you already have a VBA routine to do the import, you could just add a line to update the cell in column B for that row with your formula.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 18 ·
Replies
18
Views
6K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 7 ·
Replies
7
Views
8K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
26K
  • · Replies 19 ·
Replies
19
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K