Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 275
Default i need a macro to read blank cells

i need a macro to check all blank cells in column E then move what is in
column D in the same row into that cell
if the coresponding cell in column D is blank tehn we use wahtever value is
in the C column.

please make it simple with tons of comments as am new to macros and would
like to write my own macros.




  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,173
Default i need a macro to read blank cells

Anthony

Try this

Sub findBlanksInE()
'Assign a variable to hold last row number
Dim lLastRow As Long
'Assign a variable to hold the range object
Dim myCell As Range
'Find the last row in column E by going to bottom/up
lLastRow = Range("E65536").End(xlUp).Row
'iterate each cell (myCell) in the defined range
For Each myCell In Range("E1:E" & lLastRow)
'If the cell is blank ""
If myCell = "" Then
'If the cell, offset one column Left(D) is not blank
If myCell.Offset(0, -1).Value < "" Then
myCell.Value = myCell.Offset(0, -1).Value
Else
'If cell, offset 1 column left IS blank, use two columns left (C)
myCell.Value = myCell.Offset(0, -2).Value
End If
End If
'Loop to next cell
Next myCell
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"anthony" wrote in message
...
i need a macro to check all blank cells in column E then move what is in
column D in the same row into that cell
if the coresponding cell in column D is blank tehn we use wahtever value
is
in the C column.

please make it simple with tons of comments as am new to macros and would
like to write my own macros.





  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default i need a macro to read blank cells

Sub movefromcold()
For Each c In Range("c2:c10").SpecialCells(xlBlanks)
c.Offset(, 1).Cut c
Next
End Sub


--
Don Guillett
SalesAid Software

"anthony" wrote in message
...
i need a macro to check all blank cells in column E then move what is in
column D in the same row into that cell
if the coresponding cell in column D is blank tehn we use wahtever value
is
in the C column.

please make it simple with tons of comments as am new to macros and would
like to write my own macros.






  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 275
Default i need a macro to read blank cells


DOES THIS MACRO COPY THE VALUES FROM THE D (OR C) COLUMNS INTO THE E COLUMN
OR DOES IT MOVE THEM. COZ I NEED TO MOVE THEM (NOT COPY)
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default i need a macro to read blank cells

Please don't SHOUT. It is considered to be very bad netiquette and will not
make you friends here. Did you not see my post? Even if Nicks just did a
copy, you can always then delete or clear contents of the un-needed column.

Sub movefromcold()
For Each c In Range("d2:d100").SpecialCells(xlBlanks)
c.Offset(, 1).Cut c
Next
End Sub


--
Don Guillett
SalesAid Software

"anthony" wrote in message
...

DOES THIS MACRO COPY THE VALUES FROM THE D (OR C) COLUMNS INTO THE E
COLUMN
OR DOES IT MOVE THEM. COZ I NEED TO MOVE THEM (NOT COPY)



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
Using a Macro to paste into Blank Cells phillipsb Excel Worksheet Functions 0 October 5th 05 05:58 PM
Generating truly blank cells Nat Excel Worksheet Functions 4 September 30th 05 11:39 PM
enter numbers in blank cells bill gras Excel Worksheet Functions 2 September 21st 05 01:17 PM
Counting blank and filled cells within a range. greg7468 Excel Discussion (Misc queries) 3 June 28th 05 10:41 PM
Macro to omit blank cells needed Emece Excel Worksheet Functions 4 June 21st 05 08:07 PM


All times are GMT +1. The time now is 12:05 AM.

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

About Us

"It's about Microsoft Excel"