variable column

  1. F

    Defining a Variable for Columns for Use in Select Case

    Intro: I have a lot of data in columns in Excel. I can already use: Select Case Range ("A1").value to give me the value of A1 and use that to do various things with. For instance, if I wanted to return a message based on the data in A1: Select Case Range ("A1").value Case "" Case "Yes" MsgBox...
  2. J

    How to create a VLOOKUP in VBA with a variable array/column index dependent on number of columns

    Hi there, I was wondering if anyone had any ideas on how to accomplish this. Currently, I have customer reports that I am creating macros for that analyzes the data on the report. The problem is the format of the report changes depending on which columns the customer wants to display...
  3. Conditional format, variable rows and columns

    Hello I have this formula for conditional formatting to highlight a row: =AND(OR(COUNTIF($D$5:$F$8,$D5:$F5)>=2),$G5<>0) If any of the values on the row is reapeatead in the range and another condition is true then highlight the row, the thing is I only know where the range begins, the end...
  4. Alan_P

    Excel VBA - Find last used cell of a variable column number?

    Hi All, Just wondering if anyone knows if there is a better way of finding the last used row when the column is variable? So normally I would just use the below code to find the last row; Range("A" & Rows.Count).End(xlUp).Row But in the code I've done I am finding the column via it's number...
  5. P

    VBA - Conditional Formatting with variable reference cell?

    Hello, I've searched everywhere and cannot find a solution to my situation. Many thanks in advance for any guidance. I have a macro that conditionally formats a column of variable row length to certain conditions based on the values found in an adjacent column, for which I used the following...
  6. R

    Empty Cell with variable range

    Hey! In my macro I want to check if a cell is empty or not before writing it over, but with my code it always thinks the cell is empty, what am I doing wrong? Sub Macro 1 Dim r As Integer r = Application.Match(Sheets("Sheet1").Range("A1"), Sheets("Sheet2").Range("A1:ZZ1"), 0) If...
  7. W

    Creating dynamic multi (and variable) column remove duplicates in VBA

    Using Excel 2010 on a Windows 7 machine. Trying to create code to allow a user to hit a button and have the data remove duplicates for the data selected. For example, if the columns are WBS, Labor Category, and Name, the user can select any combination of those three to produce a listing of the...
  8. R

    vba For Loop using AutoFilter with Variable Criteria

    I'm trying to automate several daily reports, and have run into a snag on my 1st go at it :confused:... I used the Macro Recorder to lay the groundwork, and then consolidated the repetitive steps in a For Each/Next loop. It begins with 1 sheet that needs to be cut and pasted across up to 5...
  9. S

    Syntax to input variable column references into formula

    Hi. I have an Excel 2007 workbook and on one worksheet it includes a formula all the way down Column H as follows: {=MAX(IF(NOT(ISBLANK('ReferencedSheet'!F$2:F$62)),ROW('ReferencedSheet'!F$2:F$62),0))-1} The worksheet it is on is not 'ReferencedSheet' but BaseSheet. I have tested it and it...
  10. P

    Excel formula for variable number of columns

    I am looking to place a formula which will look like this: =min("A2:?2"), where ? depends on "number of columns". If number of columns is 4, then it should be D, E or Z. Number of columns is specified as an integer in range("B2"). I do not want to do it in a macro, want to do it in the...
  11. E

    Count values only in a column of a range

    SOLVED! Hello I have data in a matrix, I want to count values in 1 particular column of this matrix (say the second column, or the third column). The column is variable so I need a formula like : COUNT (Range, Column, Criteria) This formula does not exist. Could you please tell me a walk...
  12. D

    Locked-in vs. variable parts of a function

    I have a file with multiple worksheets. The worksheets are labeled Jan, Feb, etc. Each worksheet has the exact same text with variable numbers (it is questions on a survey with the subsequent data). Following the worksheets (12 for 12 months) is an additional worksheet that acts as a data funnel...
  13. M

    ActiveCell.FormulaR1C1 with a variable

    OK, so I recorded the following formula in excel but I need to change it so that it uses a variable for the column instead of a fixed column Currently I have: ActiveCell.FormulaR1C1 = "=SUM('Inbound Calls Handled'!C[-1])" I need something like: ActiveCell.FormulaR1C1 = "=SUM('Inbound...
  14. C

    Help needed in VBA, defining a variable range from excel

    Was wondering if someone could help me with defining a range from data in excel. I have a lot of data in excel that varies both by rows and columns. I need to define this array in VBA, but want it to change if more columns or rows are added e.g array may be from C6:k100 but then change to...
  15. F

    Sum over a variable column - defined by the first row

    Hi all, Here is my issue: I have few columns (let's say 10). In the first row of eacj column I have the name of a category (e.g. Cat A, Cat B, Cat C, etc) and below I have a bunch of numbers. I would like to create a summary sheet where I add the numbers for each category. The category only...

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
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 "".
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