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: 536
Default Shifting rows down in a table



I submitted this little code to a user and when he tried it I out found out that the range he was using this code on is a table, "error can't shift rows in a table" is the result.

I seldom work with tables and was unaware of this problem.
Range("C7:F7) is named FourBy, he wants to enter data in that range and run the code and insert that data at the top of the list that is accumulating just below Range FourBy. So whatever he enters goes to the top of the list and FourBy is cleared and C7 is selected ready for the next entry.

Along with not able to shift rows in a table I find if I use FourBy in the
....CountA(Range("C7:F7")) it doesn't fly, but in the Else part it is okay.

I tried to NOT use Select but cannot seem to escape the three Selects in the code. Could not make With Range("FourBy")... and With cells(4, 7)...work for me.

Any ideas?

Option Explicit

Sub CopyFourByA()
If WorksheetFunction.CountA(Range("C7:F7")) = 0 Then
MsgBox "Nothing to copy!"
Exit Sub
Else
Range("FourBy").Select
Selection.Copy
Range("C7").Select
Selection.Insert Shift:=xlDown
Range("FourBy").ClearContents
Range("C7").Select
End If
End Sub

Thank.
Howard
 
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
Rows are shifting slightly when printed Matt Lauer Excel Discussion (Misc queries) 4 October 2nd 09 06:40 PM
Deleting Rows and Shifting Up - Repost D.Parker Excel Discussion (Misc queries) 14 October 11th 07 04:58 AM
Shifting rows into columns biggg_fish Excel Discussion (Misc queries) 2 March 28th 07 03:13 AM
Pasting Data without shifting Down rows D Zandveld Excel Programming 2 March 21st 07 12:50 AM
Looping through rows and shifting certain contents Steven Excel Programming 3 January 13th 06 08:41 PM


All times are GMT +1. The time now is 09:19 AM.

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"