Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Text wrap in merged cells | Excel Discussion (Misc queries) | |||
text outside merge cells despite clicking wrap text | Excel Worksheet Functions | |||
cut/paste text into cells (wrap text) | Excel Discussion (Misc queries) | |||
merged cells and wrap text | Excel Discussion (Misc queries) | |||
Merging cells and text wrap | New Users to Excel |