LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default code skips blanks in data

Hi I am using the following code to re-format a spreadsheet . It is desigend
to move data on a stock item from a two row display to a single row for each
item. The code below does this generally, but if there are blank fields in
the data ithe cells are skipped. I think there is a problem with the
Selection(0).End(xlDown)(2).Select l.....part of the code

and the 'With Selection' step does not run and so the counter for the i
variable does not register. Hence when the end of the column is reached there
is an error message. Can anyone figure this out and help please


Sub Movem()
'
' Movem Macro
' Macro recorded 25/01/2005 by dannys
'
' Keyboard Shortcut: Ctrl+m


Dim i As Integer: i = 1
Dim rng As Range
Dim rows As Integer
Dim c As Integer


Set rng = ActiveSheet.UsedRange.rows
rows = rng.Count


For c = 1 To 11 Step 2

Cells(6, c).Select
Do Until i = (rows - 6) / 2

With Selection
Selection.Cut Destination:=ActiveCell.Offset(-1, 1)
Selection(0).End(xlDown)(2).Select
End With

i = i + 1

Loop

With Selection
Selection.Cut Destination:=ActiveCell.Offset(-1, 1)

End With

i = 1

Next c


End Sub
 
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
TAB to enter data, it skips one or more cells anxious Excel Worksheet Functions 1 July 9th 09 03:44 PM
Data Validation skips rows jk Setting up and Configuration of Excel 1 July 25th 06 09:15 AM
when I enter data in my worksheet, it skips to much lower boxes maribeth Charts and Charting in Excel 1 August 17th 05 12:55 PM
Paste Special Skip Blanks not skipping blanks, but overwriting... gsrosin Excel Discussion (Misc queries) 0 February 22nd 05 03:33 AM
Code execution skips Application.Run statement Stuart[_5_] Excel Programming 2 March 6th 04 07:11 PM


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