Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Simple question

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   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Simple question

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Simple question

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Simple question

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Simple question

Perfecto!!
Thanks a lot
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
Simple question- please help! Mark31 Excel Discussion (Misc queries) 5 November 27th 07 02:41 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM
Simple Question Bill Henning Excel Programming 2 April 18th 05 02:43 PM
simple question, hopefully a simple answer! Matt B Excel Programming 5 January 13th 04 08:43 PM


All times are GMT +1. The time now is 01:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"