Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Need Help with Macro Code

Hello!
I need some help with a macro code for excel. I'm a beginner who
doesn't know quite how to do begin. I have records in rows in an Excel
spread sheet, I need code that would check each record to see if data
is present in column AB cell. If AB is NOT blank, I need it to check if
column AA cell is blank. If it AA is blank, I need it to copy the data
from column B cell to column AA cell...again only if column AB is not
blank and AA is blank (if AB is blank, it shouldn't do anything). Hope
that made sense. Thanks in advance for all your help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Need Help with Macro Code


For i = 1 To Cells(Rows.Count,"AB").End(xlUp).Row
If Cells(i,"AB").Value < "" Then
If Cells(i,"AA").Value = "" Then
Cells(i,"AA"),value = Cells(i,"B").Value
End If
End If
Next i

--
HTH

Bob Phillips

wrote in message
ups.com...
Hello!
I need some help with a macro code for excel. I'm a beginner who
doesn't know quite how to do begin. I have records in rows in an Excel
spread sheet, I need code that would check each record to see if data
is present in column AB cell. If AB is NOT blank, I need it to check if
column AA cell is blank. If it AA is blank, I need it to copy the data
from column B cell to column AA cell...again only if column AB is not
blank and AA is blank (if AB is blank, it shouldn't do anything). Hope
that made sense. Thanks in advance for all your help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Need Help with Macro Code

Hello, Bob! Thanks for the help. I tried your code but got the
following error
Compile error: syntax error on the Cells(i,"AA"),value =
Cells(i,"B").Value line
Any ideas on how to fix? Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Need Help with Macro Code

It was a typo:

Cells(i,"AA"),value
should have been:

Cells(i,"AA").Value



wrote:

Hello, Bob! Thanks for the help. I tried your code but got the
following error
Compile error: syntax error on the Cells(i,"AA"),value =
Cells(i,"B").Value line
Any ideas on how to fix? Thanks!


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Need Help with Macro Code

I tried fixing the typo but I'm getting the same error on the same
line. Any ideas? thanks!

Dave Peterson wrote:
It was a typo:

Cells(i,"AA"),value
should have been:

Cells(i,"AA").Value



wrote:

Hello, Bob! Thanks for the help. I tried your code but got the
following error
Compile error: syntax error on the Cells(i,"AA"),value =
Cells(i,"B").Value line
Any ideas on how to fix? Thanks!


--

Dave Peterson




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Need Help with Macro Code

Juts tested it with the typo fixed, works as I read the requiremnet.

--
HTH

Bob Phillips

wrote in message
oups.com...
I tried fixing the typo but I'm getting the same error on the same
line. Any ideas? thanks!

Dave Peterson wrote:
It was a typo:

Cells(i,"AA"),value
should have been:

Cells(i,"AA").Value



wrote:

Hello, Bob! Thanks for the help. I tried your code but got the
following error
Compile error: syntax error on the Cells(i,"AA"),value =
Cells(i,"B").Value line
Any ideas on how to fix? Thanks!


--

Dave Peterson




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
Deleting code from a macro (by a macro) Brettjg Excel Discussion (Misc queries) 2 May 8th 07 10:14 PM
read macro code by vb code Francesco Geri Excel Programming 2 October 7th 05 10:24 AM
do anybody have a sample code for executing excel macro from vb code?<eom B Deepak Excel Programming 2 September 30th 05 09:59 AM
Macro copying macro code TNSKHelp Excel Programming 1 June 17th 05 04:59 PM
Macro to change Macro code? Kaisies Excel Programming 2 March 23rd 05 03:34 AM


All times are GMT +1. The time now is 11:46 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"