Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Shifting of Multiple Row to the right
 
Posts: n/a
Default Creating a macro commad to shift selected rows to the right next c

Pls Help....
The command for cutting and pasting a single row looks likes this

Range("A746:H746").Select
Selection.Cut
Range("B746").Select
ActiveSheet.Paste

There again for another row i need to do the same thing as what i had did
for the pervious.

Range("A748:H748").Select
Selection.Cut
Range("B748").Select
ActiveSheet.Paste
Range("C749").Select

And i had more than hundred thousand of selected rows to be shift to the
right, cause is a data collected from vendor and the complie data is some
thing lke this:-

328 Sales $ 0 0 0 0 0
Qnty 0 0 0 0 0 0 0
509 Sales $ 0 0 0 0 0
Qnty 0 0 0 0 0 0 0

ALEX Sales $ 0 0 0 0 0
Qnty 0 0 0 0 0 0 0
ALJUNIED Sales $ 0 0 0 0 0 0
Qnty 0 0 0 0 0 0 0
ANCH Sales $ 0 0 0 0 0
Qnty 0 0 0 0 0 0 0
ANG Sales $ 0 0 0 0 0 0
Qnty 0 0 0 0 0 0 0

As u can see the qnty is not the same column as the sale column.
Thx a million for your help.
  #2   Report Post  
Rowan
 
Posts: n/a
Default

You might try something like this which will move each row which has
Qnty in column A one cell to the right.

Sub MoveData()
Dim i As Long
Dim cRange As Range
Dim cell As Range
If Range("A65536").Value < Empty Then
i = Cells(Rows.Count, 1).End(xlUp).Row
Else
i = 65536
End If
Set cRange = Range(Cells(1, 1), Cells(i, 1))
For Each cell In cRange
If cell.Value = "Qnty" Then
cell.Insert Shift:=xlToRight
End If
Next cell
End Sub

Hope this helps
Rowan

Shifting of Multiple Row to the right wrote:
Pls Help....
The command for cutting and pasting a single row looks likes this

Range("A746:H746").Select
Selection.Cut
Range("B746").Select
ActiveSheet.Paste

There again for another row i need to do the same thing as what i had did
for the pervious.

Range("A748:H748").Select
Selection.Cut
Range("B748").Select
ActiveSheet.Paste
Range("C749").Select

And i had more than hundred thousand of selected rows to be shift to the
right, cause is a data collected from vendor and the complie data is some
thing lke this:-

328 Sales $ 0 0 0 0 0
Qnty 0 0 0 0 0 0 0
509 Sales $ 0 0 0 0 0
Qnty 0 0 0 0 0 0 0

ALEX Sales $ 0 0 0 0 0
Qnty 0 0 0 0 0 0 0
ALJUNIED Sales $ 0 0 0 0 0 0
Qnty 0 0 0 0 0 0 0
ANCH Sales $ 0 0 0 0 0
Qnty 0 0 0 0 0 0 0
ANG Sales $ 0 0 0 0 0 0
Qnty 0 0 0 0 0 0 0

As u can see the qnty is not the same column as the sale column.
Thx a million for your help.

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
I want to sort selected cells in Excel, not entire rows. Aeryn635 Excel Discussion (Misc queries) 1 June 1st 05 07:58 PM
Adding Rows to Master Sheet Excel Newbie New Users to Excel 1 December 23rd 04 10:56 PM
macro - adding rows to a column that is summed HGood Excel Discussion (Misc queries) 2 December 1st 04 03:28 PM
Creating a macro Macro Insite Excel Worksheet Functions 3 November 25th 04 11:08 PM
Display selected rows from one worksheet to another Brian Excel Worksheet Functions 5 October 29th 04 12:26 PM


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