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


I am looking for code to do the following:

If cells J, K, L, & M are empty then move cells "E" to "D" and "H" t
"G". I need to do this on records 1-9999.

Thanks,

Me

--
Metraza
-----------------------------------------------------------------------
Metrazal's Profile: http://www.excelforum.com/member.php...fo&userid=3164
View this thread: http://www.excelforum.com/showthread.php?threadid=51839

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Moving some cells.

Hi Metrazal,

Try this. Where I entered this formula in Column I and pulled down.

=COUNTA(J1:M1)

If column I is not usable then any free column will do, just chang the code
to reflect the other column instead of I1 and I100.

Sub IfEmptyMoveIt()
Dim i As Integer
Range("I1").Select
For i = 1 To Range("I100").End(xlUp).Row
If ActiveCell.Value = 0 Then
ActiveCell.Offset(, -4).Cut ActiveCell.Offset(, -5)
ActiveCell.Offset(, -1).Cut ActiveCell.Offset(, -2)
End If
ActiveCell.Offset(1, 0).Select
Next
End Sub

HTH
Regards,
Howard

"Metrazal" wrote in
message ...

I am looking for code to do the following:

If cells J, K, L, & M are empty then move cells "E" to "D" and "H" to
"G". I need to do this on records 1-9999.

Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile:
http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=518398



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Moving some cells.


It seems to move the data regardless if data is in cells j:m and it
seems to stop at about 94 records. Any ideas?

Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile: http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=518398

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Moving some cells.

Hi Met,

I somehow overlooked the 9999 row thing. So change

For i = 1 To Range("I100").End(xlUp).Row to:

For i = 1 To Range("I15000").End(xlUp).Row or to

For i = 1 To 9999

Did you insert the formula in column I and fill down to end of data?
And you say it moves stuff even if the cells are populated? Not sure whats
going on there.

Can you send me a sample workbook of what you have, don't need 9999 rows but
a true sample of about 30 - 50 rows of what you have.



Regards,
Howard

"Metrazal" wrote in
message ...

I am looking for code to do the following:

If cells J, K, L, & M are empty then move cells "E" to "D" and "H" to
"G". I need to do this on records 1-9999.

Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile:
http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=518398



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Moving some cells.


Got it to work. I previously did not enter the calculation data in
column A. Thanks..

However, its very slow..

Does anyone know of a faster way to achieve this?

Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile: http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=518398



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Moving some cells.

Hi Met,

I revised the code to a For each cell in Range/Next and it took about 11
seconds to do 11,000 rows. Is that faster than what than what you have?

Regards,
Howard

"Metrazal" wrote in
message ...

I am looking for code to do the following:

If cells J, K, L, & M are empty then move cells "E" to "D" and "H" to
"G". I need to do this on records 1-9999.

Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile:
http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=518398



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
Moving text around cells without moving boarder lines Dale Excel Discussion (Misc queries) 1 December 15th 09 06:14 PM
Enter Key + Dragging Cells / Moving Cells Tim Excel Discussion (Misc queries) 2 September 24th 08 11:14 AM
Arrow Keys Moving Window Frame instead of Moving Between Cells nemmex Excel Discussion (Misc queries) 2 April 9th 07 09:08 AM
Moving cells malcolm Excel Worksheet Functions 0 November 9th 06 08:40 PM
Cells(col,row) keep moving to lower case and I can not ref. a cells in a differnet sheet WayneL[_2_] Excel Programming 2 April 25th 05 11:27 PM


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