Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
With the below statement I am trying to put "EUR" in column C as long as there is a value in column A. Unfortunately column C stays empty. Does anyone know what goes wrong or should I use a different statement? Thanks a lot! Regards, Robert Dim aLastRow As Long, aNextRow As Long Dim a As Long aNextRow = 5 With Worksheets("BarraFormatLiabilities") aLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For a = 1 To aLastRow If .Cells(a, "A").Value = "" Then aNextRow = aNextRow + 1 .Cells(a, "C").Value = "EUR" Value.Paste End If Next a End With |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The only thing I see wrong is you don't need the dot infront of rows.count.
there is also things you don't need in the code. He is the fixed code Dim aLastRow As Long Dim a As Long With Worksheets("BarraFormatLiabilities") aLastRow = .Cells(Rows.Count, "A").End(xlUp).Row For a = 1 To aLastRow if .Cells(a, "A").Value = "" Then .Cells(a, "C").Value = "EUR" End If Next a End With "Robert" wrote: Hi All, With the below statement I am trying to put "EUR" in column C as long as there is a value in column A. Unfortunately column C stays empty. Does anyone know what goes wrong or should I use a different statement? Thanks a lot! Regards, Robert Dim aLastRow As Long, aNextRow As Long Dim a As Long aNextRow = 5 With Worksheets("BarraFormatLiabilities") aLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For a = 1 To aLastRow If .Cells(a, "A").Value = "" Then aNextRow = aNextRow + 1 .Cells(a, "C").Value = "EUR" Value.Paste End If Next a End With |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Joal,
Thanks for your support! I changed the code but still no values in column C... Forgot to mention that the if then should start at row5. Rgds, Robert |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Then change
from For a = 1 To aLastRow to For a = 5 To aLastRow "Robert" wrote: Hi Joal, Thanks for your support! I changed the code but still no values in column C... Forgot to mention that the if then should start at row5. Rgds, Robert |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think your text is backwards, try this code. I changed = to <
Dim aLastRow As Long Dim a As Long With Worksheets("BarraFormatLiabilities") aLastRow = .Cells(Rows.Count, "A").End(xlUp).Row For a = 5 To aLastRow if .Cells(a, "A").Value < "" Then .Cells(a, "C").Value = "EUR" End If Next a End With "Robert" wrote: Hi Joal, Thanks for your support! I changed the code but still no values in column C... Forgot to mention that the if then should start at row5. Rgds, Robert |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perfecto!!
Thanks a lot |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF formula-simple question; simple operator | Excel Discussion (Misc queries) | |||
Simple question- please help! | Excel Discussion (Misc queries) | |||
Simple Simple Excel usage question | Excel Discussion (Misc queries) | |||
Simple Question | Excel Programming | |||
simple question, hopefully a simple answer! | Excel Programming |