Thread: Simple question
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Simple question

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