Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Find empty cell and input data for other cells

Hi,
I want to move (cut paste?) cell content from columns D:F to the left by
one position (offset?). When cell C is empty. This test I am trying is setup
for
only 4 rows d2:d5 (hear in rown 1), but the real work will have 2300 rows
involved. This is
a situation where data coming is to us is not formated correctly (i.e.)
city,state,zip
which should be situated in cells C,D & E is on some rows located in D,E & F

Sub OffsetRange()
Dim r As Range
Dim myVar
Dim myCell As Range
Set myCell = Range("C2:c5")
Dim c As Range
Set c = Range("D:F")
For Each r In Range("C2:C5" & Cells(Rows.Count, "c").End(xlUp).Row)
myVar = IsEmpty(r.Value)
If myVar = True Then
?????? I'm lost here

End If
Next
End Sub

Any help appreciated
Rick




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Find empty cell and input data for other cells

Hey, Rick. I'd do it like this:

Public Sub OffsetRange()
cells(2,1).select '"A2"

do until activecell = "" 'til last row of the column A
if activecell.offset(0,2)="" Then 'C is blank
activecell.offset(0,2)=activecell.offset(0,3)
activecell.offset(0,3)=activecell.offset(0,4)
activecell.offset(0,4)=activecell.offset(0,5)
end if
End Sub

You didn't say if there was anything in columns G, H, etc.....

Chris

On Mar 11, 9:22*am, Rick K wrote:
Hi,
* I want to move (cut paste?) cell content from columns D:F to the left by
one position (offset?). When cell C is empty. This test I am trying is setup
for
only 4 rows d2:d5 (hear in rown 1), but the real work will have 2300 rows
involved. This is
a situation where data coming is to us is not formated correctly (i.e.)
city,state,zip
which should be situated in cells C,D & E is on some rows located in D,E & F

Sub OffsetRange()
Dim r As Range
Dim myVar
Dim myCell As Range
* * Set myCell = Range("C2:c5")
Dim c As Range
* * Set c = Range("D:F")
* * For Each r In Range("C2:C5" & Cells(Rows.Count, "c").End(xlUp).Row)
* * *myVar = IsEmpty(r.Value)
* * * * If myVar = True Then
* * * * ?????? I'm lost here

* * * * End If
* * Next
End Sub

Any help appreciated
Rick


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find empty cell and input data for other cells

Give this macro a try...

Sub MoveBadRanges()
Dim R As Range
With Worksheets("Sheet2")
For Each R In .Range("C1:C" & .UsedRange.Rows.Count).Cells. _
SpecialCells(xlCellTypeBlanks)
R.Offset(0, 1).Resize(1, 3).Copy R
R.Offset(0, 3).Clear
Next
End With
End Sub

Rick


"Rick K" wrote in message
...
Hi,
I want to move (cut paste?) cell content from columns D:F to the left by
one position (offset?). When cell C is empty. This test I am trying is
setup
for
only 4 rows d2:d5 (hear in rown 1), but the real work will have 2300 rows
involved. This is
a situation where data coming is to us is not formated correctly (i.e.)
city,state,zip
which should be situated in cells C,D & E is on some rows located in D,E &
F

Sub OffsetRange()
Dim r As Range
Dim myVar
Dim myCell As Range
Set myCell = Range("C2:c5")
Dim c As Range
Set c = Range("D:F")
For Each r In Range("C2:C5" & Cells(Rows.Count, "c").End(xlUp).Row)
myVar = IsEmpty(r.Value)
If myVar = True Then
?????? I'm lost here

End If
Next
End Sub

Any help appreciated
Rick





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
My Worksheet Needs to Input Cell Data Automatically to Other Cells Breezy Excel Worksheet Functions 1 April 14th 09 02:17 AM
Find empty cells, fill with text from cell above Marketer Excel Worksheet Functions 1 August 27th 07 10:35 PM
code to go down a column and find the last cell with data before an empty cell Steve G Excel Programming 1 July 23rd 07 08:22 AM
Not allowing users to enter data into certain cells if another cell is empty KimberlyC Excel Programming 12 May 6th 05 06:19 PM
A macro to tell excel to input to next empty cell Help Me Rhonda TOA[_2_] Excel Programming 1 November 16th 04 03:02 PM


All times are GMT +1. The time now is 12:34 PM.

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"