# last used row in column C equals last used row in column E

#### FROGGER24

##### New Member
Hello everyone, I could use some help in finding last used rows. If C1 is >0, I need the last used row in column C to equal last used row in column E.

thanks

### Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

#### shknbk2

##### Board Regular
When do you want this to happen? Automatically whenever the value in C1 changes?

Let's say that C1 > 0 and that column C uses rows 1-15 and column E uses 1-10, do you simply want to delete C11-C15?

What if C uses rows 1-5? Do you want to add values to C6-C10?

#### FROGGER24

##### New Member
if I understand your question correctly, the columns will be the same length

#### shknbk2

##### Board Regular
Are you asking to make sure that if C1 > 0, then set the value of C10 the same as E10 (assuming that these are the last cells in the columns)?

that is correct

#### shknbk2

##### Board Regular
Put this in the worksheet's code area.

Code:
``````Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "\$C\$1" Then
If Target.Value > 0 Then
Cells(Rows.Count, 3).End(xlUp).Value = Cells(Rows.Count, 5).End(xlUp).Value
End If
End If
End Sub``````

#### FROGGER24

##### New Member
thank you, the code worked fine.

#### FROGGER24

##### New Member
can the code be modified so it is a regular formula versus worksheet change event?

#### FROGGER24

##### New Member
i think the formula should look like this in B1 =if(\$C\$1=0,c1&lr,(C1&LR =E1&lr)

#### shknbk2

##### Board Regular
I don't know what your values are in columns C & E, but to have a formula control the values, the cells in C have to be formulas.

1,101,997
Messages
5,484,100
Members
407,430
Latest member
sgoldman

### This Week's Hot Topics

• Finding issue in If elseif else with For each Loop
Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
• MsgBox Error
Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
• CELL FORMAT - IF CONDITION
My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
• Show numbers nearly the same
Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
• Please i need your help to create formula
I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
• Got error while adding column and filter
Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...