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

Have come across a situation where, for presentation purposes the SUBTOTAL
rows need to be moved one cell to the right.
Have been struggling with the following but need some assistance, which will
be greatly appreciated.
Regards,
- Mike


For Each c In Range("b2:b100")
If InStr((c.Value), "Total") Then
c.Cut Destination:=ActiveCell.Offset(0, 1)

End If
Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Move SUBTOTAL cells

Try inserting a cell which will "push" the other cells to the right (or down)

Dim Cell As Range
'
For Each Cell In Range("b2:b100")
If InStr(Cell, "Total") 0 Then Cell.Insert Shift:=xlToRight
Next Cell


"MikeF" wrote:

Have come across a situation where, for presentation purposes the SUBTOTAL
rows need to be moved one cell to the right.
Have been struggling with the following but need some assistance, which will
be greatly appreciated.
Regards,
- Mike


For Each c In Range("b2:b100")
If InStr((c.Value), "Total") Then
c.Cut Destination:=ActiveCell.Offset(0, 1)

End If
Next

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Move SUBTOTAL cells

That's exactly what I had at first, but it also pushes everything else on
each row to the right --- needed only the text moved.
But ended up figuring it out, here's that solution ...

For Each c In Range("b2:b100")
If InStr((c.Value), "Total") Then
c.Activate
c.Cut Destination:=ActiveCell.Range("b1")
End If
Next

"Charlie" wrote:

Try inserting a cell which will "push" the other cells to the right (or down)

Dim Cell As Range
'
For Each Cell In Range("b2:b100")
If InStr(Cell, "Total") 0 Then Cell.Insert Shift:=xlToRight
Next Cell


"MikeF" wrote:

Have come across a situation where, for presentation purposes the SUBTOTAL
rows need to be moved one cell to the right.
Have been struggling with the following but need some assistance, which will
be greatly appreciated.
Regards,
- Mike


For Each c In Range("b2:b100")
If InStr((c.Value), "Total") Then
c.Cut Destination:=ActiveCell.Offset(0, 1)

End If
Next

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Move SUBTOTAL cells

Your original just needed a tweak

For Each c In Range("b2:b100")
If InStr((c.Value), "Total") Then
c.Cut Destination:=c.Offset(0, 1)
End If
Next

You don't have to activate or select anything.


Gord Dibben MS Excel MVP

On Tue, 20 Jan 2009 07:27:01 -0800, MikeF
wrote:

That's exactly what I had at first, but it also pushes everything else on
each row to the right --- needed only the text moved.
But ended up figuring it out, here's that solution ...

For Each c In Range("b2:b100")
If InStr((c.Value), "Total") Then
c.Activate
c.Cut Destination:=ActiveCell.Range("b1")
End If
Next

"Charlie" wrote:

Try inserting a cell which will "push" the other cells to the right (or down)

Dim Cell As Range
'
For Each Cell In Range("b2:b100")
If InStr(Cell, "Total") 0 Then Cell.Insert Shift:=xlToRight
Next Cell


"MikeF" wrote:

Have come across a situation where, for presentation purposes the SUBTOTAL
rows need to be moved one cell to the right.
Have been struggling with the following but need some assistance, which will
be greatly appreciated.
Regards,
- Mike


For Each c In Range("b2:b100")
If InStr((c.Value), "Total") Then
c.Cut Destination:=ActiveCell.Offset(0, 1)

End If
Next


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Move SUBTOTAL cells

Works great, and shorter code.
Thanx!!

"Gord Dibben" wrote:

Your original just needed a tweak

For Each c In Range("b2:b100")
If InStr((c.Value), "Total") Then
c.Cut Destination:=c.Offset(0, 1)
End If
Next

You don't have to activate or select anything.


Gord Dibben MS Excel MVP

On Tue, 20 Jan 2009 07:27:01 -0800, MikeF
wrote:

That's exactly what I had at first, but it also pushes everything else on
each row to the right --- needed only the text moved.
But ended up figuring it out, here's that solution ...

For Each c In Range("b2:b100")
If InStr((c.Value), "Total") Then
c.Activate
c.Cut Destination:=ActiveCell.Range("b1")
End If
Next

"Charlie" wrote:

Try inserting a cell which will "push" the other cells to the right (or down)

Dim Cell As Range
'
For Each Cell In Range("b2:b100")
If InStr(Cell, "Total") 0 Then Cell.Insert Shift:=xlToRight
Next Cell


"MikeF" wrote:

Have come across a situation where, for presentation purposes the SUBTOTAL
rows need to be moved one cell to the right.
Have been struggling with the following but need some assistance, which will
be greatly appreciated.
Regards,
- Mike


For Each c In Range("b2:b100")
If InStr((c.Value), "Total") Then
c.Cut Destination:=ActiveCell.Offset(0, 1)

End If
Next





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default almost what I need

Hello,
I am using this code that you posted above (with the count function rather then the subtotal); however in addition to moving the "part number Count" cell in column B five columns to the right, I also need to move the column C value directly next to the column B "part number Count" value five cells to the right - moving the "part number Count" and the actual value of the Count in the margin to the right of all my data. I am very new to VBA in excel.

Your help would be endlessly appreciated as this would save me hours of manual counting and writing on printouts.

Thank you!!



Gord Dibben wrote:

Move SUBTOTAL cells
20-Jan-09

Your original just needed a twea

For Each c In Range("b2:b100"
If InStr((c.Value), "Total") The
c.Cut Destination:=c.Offset(0, 1
End I
Nex

You don't have to activate or select anything

Gord Dibben MS Excel MV

On Tue, 20 Jan 2009 07:27:01 -0800, MikeF
wrote:

Previous Posts In This Thread:

On Monday, January 19, 2009 7:46 PM
Mike wrote:

Move SUBTOTAL cells
Have come across a situation where, for presentation purposes the SUBTOTAL
rows need to be moved one cell to the right
Have been struggling with the following but need some assistance, which will
be greatly appreciated
Regards
- Mik

For Each c In Range("b2:b100"
If InStr((c.Value), "Total") The
c.Cut Destination:=ActiveCell.Offset(0, 1

End I
Next

On Tuesday, January 20, 2009 10:06 AM
Charli wrote:

Try inserting a cell which will "push" the other cells to the right (or
Try inserting a cell which will "push" the other cells to the right (or down

Dim Cell As Rang

For Each Cell In Range("b2:b100"
If InStr(Cell, "Total") 0 Then Cell.Insert Shift:=xlToRigh
Next Cel

"MikeF" wrote:

On Tuesday, January 20, 2009 10:27 AM
Mike wrote:

That's exactly what I had at first, but it also pushes everything else on each
That's exactly what I had at first, but it also pushes everything else on
each row to the right --- needed only the text moved
But ended up figuring it out, here's that solution ..

For Each c In Range("b2:b100"
If InStr((c.Value), "Total") The
c.Activat
c.Cut Destination:=ActiveCell.Range("b1"
End I
Nex

"Charlie" wrote:

On Tuesday, January 20, 2009 12:30 PM
Gord Dibben wrote:

Move SUBTOTAL cells
Your original just needed a twea

For Each c In Range("b2:b100"
If InStr((c.Value), "Total") The
c.Cut Destination:=c.Offset(0, 1
End I
Nex

You don't have to activate or select anything

Gord Dibben MS Excel MV

On Tue, 20 Jan 2009 07:27:01 -0800, MikeF
wrote:

On Tuesday, January 20, 2009 12:41 PM
Mike wrote:

Move SUBTOTAL cells
Works great, and shorter code
Thanx!

"Gord Dibben" wrote:

EggHeadCafe - Software Developer Portal of Choice
JavaScript DatePicker
http://www.eggheadcafe.com/tutorials...atepicker.aspx
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default got it!

Ah hah!
I'm sorry to waste your time. I've figured it out!

Sub movesubtotal()
For Each c In Range("b2:b100")
If InStr((c.Value), "Count") Then
c.Cut Destination:=c.Offset(0, 5)
End If
Next
For Each d In Range("c2:c100")
If InStr((d.Formula), "SUBTOTAL") Then
d.Cut Destination:=d.Offset(0, 5)
End If
Next

End Sub


Let me know if you see anything that can be improved.

Thank you!



Brandon S wrote:

almost what I need
02-Nov-09

Hello,
I am using this code that you posted above (with the count function rather then the subtotal); however in addition to moving the "part number Count" cell in column B five columns to the right, I also need to move the column C value directly next to the column B "part number Count" value five cells to the right - moving the "part number Count" and the actual value of the Count in the margin to the right of all my data. I am very new to VBA in excel.

Your help would be endlessly appreciated as this would save me hours of manual counting and writing on printouts.

Thank you!!

Previous Posts In This Thread:

EggHeadCafe - Software Developer Portal of Choice
FLASH: Fix for Windows Vista
http://www.eggheadcafe.com/tutorials...indows-vi.aspx
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
CountA, Subtotal and "move to the first cell in the next column" LongBeachGuy Excel Programming 4 October 17th 07 02:59 AM
CountA, Subtotal and "move to the first cell in the next column" LongBeachGuy Excel Discussion (Misc queries) 1 October 16th 07 10:57 PM
CountA, Subtotal and "move to the first cell in the next column" LongBeachGuy Excel Programming 0 October 16th 07 10:29 PM
move to another cell within a subtotal report within a macro NoelH Excel Worksheet Functions 1 August 31st 05 03:02 PM
HOW DO I MOVE A DESCRIPTION OR NAME INTO A SUBTOTAL LINE BEACHGRANDPA Excel Worksheet Functions 0 August 24th 05 04:46 PM


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