Formula to copy row A down?

sobeitjedi

Board Regular
Joined
Mar 13, 2006
Messages
190
Hi

I need a formula that will copy the data is the first row of AFGIJKLMNOPQR down the sheet, as far down as long as there is data in column C?

Can you help?
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,341
in A1
=IF($C1="","",A1)

Is it ALWAYS copied from row 1 ?
=IF($C1="","",A$1)

Copy the formula to the other columns F to R
and down the sheet for those columns
 

sobeitjedi

Board Regular
Joined
Mar 13, 2006
Messages
190
Sorry, I mean in VBA? The quantity of rows will differ so I can't commit to a specific row number
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
18,395
Office Version
2013
Platform
Windows
Try

Code:
Sub MM1()
Range("A1:A" & Cells(Rows.Count, "C").End(xlUp).Row).Formula = "=IF($C1="""","""",A$1)"
End Sub
 

sobeitjedi

Board Regular
Joined
Mar 13, 2006
Messages
190
No - didn't work

A1 contains a plus sign, but the formula has put 0 for all rows down. The data in FGIJKLMNOPQR hasn't copied down.
 

Tom.Jones

Board Regular
Joined
Sep 20, 2011
Messages
240
Try this:

Michael M adjusted code.
Code:
Sub MM1()
Range("A2:A" & Cells(Rows.Count, "C").End(xlUp).Row).Formula = "=IF($C1="""","""",A$1)"
Range("F2:G" & Cells(Rows.Count, "C").End(xlUp).Row).Formula = "=IF($C1="""","""",F$1)"
Range("I2:R" & Cells(Rows.Count, "C").End(xlUp).Row).Formula = "=IF($C1="""","""",I$1)"
End Sub
 

sobeitjedi

Board Regular
Joined
Mar 13, 2006
Messages
190
Looks great - thank you!

Can I add one more thing into the mix? .... if the first row is blank in any of AFGIJKLMNOPQR, then don't fill down, for that column only.
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
18,395
Office Version
2013
Platform
Windows
Try

Code:
If Range("A1") <> "" Then Range("A2:A" & Cells(Rows.Count, "C").End(xlUp).Row).Formula = "=IF($C1="""","""",A$1)"
If Range("F1") <> "" Then Range("F2:G" & Cells(Rows.Count, "C").End(xlUp).Row).Formula = "=IF($C1="""","""",F$1)"
If Range("I1") <> "" Then Range("I2:R" & Cells(Rows.Count, "C").End(xlUp).Row).Formula = "=IF($C1="""","""",I$1)"
 

Forum statistics

Threads
1,089,301
Messages
5,407,458
Members
403,143
Latest member
CTremblay

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top