Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Shift cells and then wrap text to fit.

Hello All,

How do i shift alternate cell one place right and then wrap them in a record
occuping 50000 lines. i mean i want to shift B1, then D1 and in B2 and D2
respectively and continie this utill all records are shifted.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Shift cells and then wrap text to fit.

Not sure what you mean by "wrap them in a record" but based on the rest of
your question -

Manually, select col-B header, grab the selection and drag to col-D

VBA,
Columns("B:B").Cut Destination:=Columns("D:D")

This will replace the contents of col-D with col-B

Regards,
Peter T

"Rahul Gupta" wrote in message
...
Hello All,

How do i shift alternate cell one place right and then wrap them in a

record
occuping 50000 lines. i mean i want to shift B1, then D1 and in B2 and D2
respectively and continie this utill all records are shifted.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Shift cells and then wrap text to fit.

Hello Peter,

Thanks for the kind help but i wanted some thing else. See i want to shift
all cells in a record such that contents of A1 are not affected, B1 is
shifted to B2, Again Contents of C1 are not affected but D1 is shifted to D2
and this continues. Data shifted in B2, D2 etc should be wrapped so as to fit
in the cell.

Hope this makes senario more clear.

"Peter T" wrote:

Not sure what you mean by "wrap them in a record" but based on the rest of
your question -

Manually, select col-B header, grab the selection and drag to col-D

VBA,
Columns("B:B").Cut Destination:=Columns("D:D")

This will replace the contents of col-D with col-B

Regards,
Peter T

"Rahul Gupta" wrote in message
...
Hello All,

How do i shift alternate cell one place right and then wrap them in a

record
occuping 50000 lines. i mean i want to shift B1, then D1 and in B2 and D2
respectively and continie this utill all records are shifted.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Shift cells and then wrap text to fit.

Afraid I don't quite follow, before you said you wanted to shift cells to
the right but here it looks like you want to shift all cells in col-B down
one

range("b1:b65535").Cut destination:=range("b2:b65536")

and similar with col-D

Range("B:B,D:D").Wraptext = True

I'm wondering, do also you want to do similar for every alternate column
beyond col-D?

Regards,
Peter T

and similarly in col-D
"Rahul Gupta" wrote in message
...
Hello Peter,

Thanks for the kind help but i wanted some thing else. See i want to shift
all cells in a record such that contents of A1 are not affected, B1 is
shifted to B2, Again Contents of C1 are not affected but D1 is shifted to

D2
and this continues. Data shifted in B2, D2 etc should be wrapped so as to

fit
in the cell.

Hope this makes senario more clear.

"Peter T" wrote:

Not sure what you mean by "wrap them in a record" but based on the rest

of
your question -

Manually, select col-B header, grab the selection and drag to col-D

VBA,
Columns("B:B").Cut Destination:=Columns("D:D")

This will replace the contents of col-D with col-B

Regards,
Peter T

"Rahul Gupta" wrote in message
...
Hello All,

How do i shift alternate cell one place right and then wrap them in a

record
occuping 50000 lines. i mean i want to shift B1, then D1 and in B2 and

D2
respectively and continie this utill all records are shifted.







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Shift cells and then wrap text to fit.

Hello Peter,

Yes this is want i wanted but with a diffrence i wanted it to be done only
in one row "1" and all alternate column B, D, F etc.

I have similar problem with rows even...

Rahul.
"Peter T" wrote:

Afraid I don't quite follow, before you said you wanted to shift cells to
the right but here it looks like you want to shift all cells in col-B down
one

range("b1:b65535").Cut destination:=range("b2:b65536")

and similar with col-D

Range("B:B,D:D").Wraptext = True

I'm wondering, do also you want to do similar for every alternate column
beyond col-D?

Regards,
Peter T

and similarly in col-D
"Rahul Gupta" wrote in message
...
Hello Peter,

Thanks for the kind help but i wanted some thing else. See i want to shift
all cells in a record such that contents of A1 are not affected, B1 is
shifted to B2, Again Contents of C1 are not affected but D1 is shifted to

D2
and this continues. Data shifted in B2, D2 etc should be wrapped so as to

fit
in the cell.

Hope this makes senario more clear.

"Peter T" wrote:

Not sure what you mean by "wrap them in a record" but based on the rest

of
your question -

Manually, select col-B header, grab the selection and drag to col-D

VBA,
Columns("B:B").Cut Destination:=Columns("D:D")

This will replace the contents of col-D with col-B

Regards,
Peter T

"Rahul Gupta" wrote in message
...
Hello All,

How do i shift alternate cell one place right and then wrap them in a
record
occuping 50000 lines. i mean i want to shift B1, then D1 and in B2 and

D2
respectively and continie this utill all records are shifted.










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Shift cells and then wrap text to fit.

Sub Test()
Dim rng As Range
Dim cel As Range
Dim v As Variant

' comment / uncomment / amend rng as required
'Set rng = Range("A1:Z1")
Set rng = Intersect(ActiveSheet.UsedRange, ActiveSheet.Rows(1))

For Each cel In rng
If (cel.Column Mod 2) = 0 Then
'If Len(cel.Offset(1, 0)) = 0 Then
v = cel.Value
With cel.Offset(1, 0)
.Value = v
.WrapText = True
End With
cel.ClearContents
'End If
End If
Next

End Sub

If you DON'T want to replace existing contents in row 2 (eg you re-run this
macro) then un-comment the lines
If Len(cel.Offset(1, 0)) = 0 Then ..... End IF

Regards,
Peter T

"Rahul Gupta" wrote in message
...
Hello Peter,

Yes this is want i wanted but with a diffrence i wanted it to be done only
in one row "1" and all alternate column B, D, F etc.

I have similar problem with rows even...

Rahul.
"Peter T" wrote:

Afraid I don't quite follow, before you said you wanted to shift cells

to
the right but here it looks like you want to shift all cells in col-B

down
one

range("b1:b65535").Cut destination:=range("b2:b65536")

and similar with col-D

Range("B:B,D:D").Wraptext = True

I'm wondering, do also you want to do similar for every alternate column
beyond col-D?

Regards,
Peter T

and similarly in col-D
"Rahul Gupta" wrote in message
...
Hello Peter,

Thanks for the kind help but i wanted some thing else. See i want to

shift
all cells in a record such that contents of A1 are not affected, B1 is
shifted to B2, Again Contents of C1 are not affected but D1 is shifted

to
D2
and this continues. Data shifted in B2, D2 etc should be wrapped so as

to
fit
in the cell.

Hope this makes senario more clear.

"Peter T" wrote:

Not sure what you mean by "wrap them in a record" but based on the

rest
of
your question -

Manually, select col-B header, grab the selection and drag to col-D

VBA,
Columns("B:B").Cut Destination:=Columns("D:D")

This will replace the contents of col-D with col-B

Regards,
Peter T

"Rahul Gupta" wrote in

message
...
Hello All,

How do i shift alternate cell one place right and then wrap them

in a
record
occuping 50000 lines. i mean i want to shift B1, then D1 and in B2

and
D2
respectively and continie this utill all records are shifted.










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
Text wrap in merged cells LC Excel Discussion (Misc queries) 1 June 15th 09 04:57 PM
text outside merge cells despite clicking wrap text chedd via OfficeKB.com Excel Worksheet Functions 5 July 17th 08 09:01 PM
cut/paste text into cells (wrap text) JoBeth Excel Discussion (Misc queries) 1 July 12th 08 12:45 AM
merged cells and wrap text Richard Excel Discussion (Misc queries) 3 July 17th 07 10:22 PM
Merging cells and text wrap Taecan New Users to Excel 2 September 30th 05 06:55 PM


All times are GMT +1. The time now is 03:33 PM.

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"