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

hi,

is seem to be going round in circles with this one and wandrered if you can
help?

i have two columns of data say A and B and some of the cells in column a are
coloured yellow
i am trying to write a macro that makes 2 new columns of data on a new sheet
for all the rows that have a cell in column a coloured yellow

any help or ideas would be much appreciated

thankyou

patrick

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default move formatted cells

For example:

Sub movit()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Range("A:B").Copy s2.Range("A1")
s2.Activate

n = Cells(Rows.Count, "A").End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, "A").Interior.ColorIndex = 6 Then
Else
s = "A" & i & ":B" & i
Range(s).Delete Shift:=xlUp
End If
Next
End Sub

First all the data is copied and then the non-yellow data is reomved.
--
Gary''s Student - gsnu200758


"Patrick Bateman" wrote:

hi,

is seem to be going round in circles with this one and wandrered if you can
help?

i have two columns of data say A and B and some of the cells in column a are
coloured yellow
i am trying to write a macro that makes 2 new columns of data on a new sheet
for all the rows that have a cell in column a coloured yellow

any help or ideas would be much appreciated

thankyou

patrick

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default move formatted cells

AWESOME!!

cheers thats a great idea! only problem is it seems to keep repeating for
ages?

"Gary''s Student" wrote:

For example:

Sub movit()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Range("A:B").Copy s2.Range("A1")
s2.Activate

n = Cells(Rows.Count, "A").End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, "A").Interior.ColorIndex = 6 Then
Else
s = "A" & i & ":B" & i
Range(s).Delete Shift:=xlUp
End If
Next
End Sub

First all the data is copied and then the non-yellow data is reomved.
--
Gary''s Student - gsnu200758


"Patrick Bateman" wrote:

hi,

is seem to be going round in circles with this one and wandrered if you can
help?

i have two columns of data say A and B and some of the cells in column a are
coloured yellow
i am trying to write a macro that makes 2 new columns of data on a new sheet
for all the rows that have a cell in column a coloured yellow

any help or ideas would be much appreciated

thankyou

patrick

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default move formatted cells

its ok, what kept happeneing is it was deleting all cells that werent yellow
so was going on for ever! made the following adjustment and it works:

Sub movit()
Set s1 = Sheets("Sheet")
Set s2 = Sheets("Sheet2")
s1.Range("A:B").Copy s2.Range("A1")
s2.Activate

n = Cells(Rows.Count, "A").End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, "A").Interior.ColorIndex = 6 Then
ElseIf Cells(i, "A").Value = " " Then

s = "A" & i & ":B" & i
Range(s).Delete Shift:=xlUp
End If
Next
End Sub

THankyou again!!

"Patrick Bateman" wrote:

AWESOME!!

cheers thats a great idea! only problem is it seems to keep repeating for
ages?

"Gary''s Student" wrote:

For example:

Sub movit()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Range("A:B").Copy s2.Range("A1")
s2.Activate

n = Cells(Rows.Count, "A").End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, "A").Interior.ColorIndex = 6 Then
Else
s = "A" & i & ":B" & i
Range(s).Delete Shift:=xlUp
End If
Next
End Sub

First all the data is copied and then the non-yellow data is reomved.
--
Gary''s Student - gsnu200758


"Patrick Bateman" wrote:

hi,

is seem to be going round in circles with this one and wandrered if you can
help?

i have two columns of data say A and B and some of the cells in column a are
coloured yellow
i am trying to write a macro that makes 2 new columns of data on a new sheet
for all the rows that have a cell in column a coloured yellow

any help or ideas would be much appreciated

thankyou

patrick

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default move formatted cells

oh and the code i posted before was wrong x sorry x

"Patrick Bateman" wrote:

its ok, what kept happeneing is it was deleting all cells that werent yellow
so was going on for ever! made the following adjustment and it works:

Sub movit()
Set s1 = Sheets("Sheet")
Set s2 = Sheets("Sheet2")
s1.Range("A:B").Copy s2.Range("A1")
s2.Activate

n = Cells(Rows.Count, "A").End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, "A").Interior.ColorIndex = 6 Then
ElseIf Cells(i, "A").Value = " " Then

s = "A" & i & ":B" & i
Range(s).Delete Shift:=xlUp
End If
Next
End Sub

THankyou again!!

"Patrick Bateman" wrote:

AWESOME!!

cheers thats a great idea! only problem is it seems to keep repeating for
ages?

"Gary''s Student" wrote:

For example:

Sub movit()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Range("A:B").Copy s2.Range("A1")
s2.Activate

n = Cells(Rows.Count, "A").End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, "A").Interior.ColorIndex = 6 Then
Else
s = "A" & i & ":B" & i
Range(s).Delete Shift:=xlUp
End If
Next
End Sub

First all the data is copied and then the non-yellow data is reomved.
--
Gary''s Student - gsnu200758


"Patrick Bateman" wrote:

hi,

is seem to be going round in circles with this one and wandrered if you can
help?

i have two columns of data say A and B and some of the cells in column a are
coloured yellow
i am trying to write a macro that makes 2 new columns of data on a new sheet
for all the rows that have a cell in column a coloured yellow

any help or ideas would be much appreciated

thankyou

patrick



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default move formatted cells

Well then, let's try a version that may be a bit faster:

Sub movit()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Range("A:B").Copy s2.Range("A1")
s2.Activate

n = Cells(Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = n To 1 Step -1
If Cells(i, "A").Interior.ColorIndex = 6 Then
Else
s = "A" & i & ":B" & i
Range(s).Delete Shift:=xlUp
End If
Next
Application.ScreenUpdating = True
End Sub

--
Gary''s Student - gsnu200758


"Patrick Bateman" wrote:

AWESOME!!

cheers thats a great idea! only problem is it seems to keep repeating for
ages?

"Gary''s Student" wrote:

For example:

Sub movit()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Range("A:B").Copy s2.Range("A1")
s2.Activate

n = Cells(Rows.Count, "A").End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, "A").Interior.ColorIndex = 6 Then
Else
s = "A" & i & ":B" & i
Range(s).Delete Shift:=xlUp
End If
Next
End Sub

First all the data is copied and then the non-yellow data is reomved.
--
Gary''s Student - gsnu200758


"Patrick Bateman" wrote:

hi,

is seem to be going round in circles with this one and wandrered if you can
help?

i have two columns of data say A and B and some of the cells in column a are
coloured yellow
i am trying to write a macro that makes 2 new columns of data on a new sheet
for all the rows that have a cell in column a coloured yellow

any help or ideas would be much appreciated

thankyou

patrick

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default move formatted cells

i have an additional problem that has cropped up.......

the coloured cells are coloured because of conditional formatting and this
causes problems when the cells are coppied and deleted.

any ideas how to get round it? is it possible to remove the conditional
formatting but keep the cells coloured?

"Gary''s Student" wrote:

Well then, let's try a version that may be a bit faster:

Sub movit()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Range("A:B").Copy s2.Range("A1")
s2.Activate

n = Cells(Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = n To 1 Step -1
If Cells(i, "A").Interior.ColorIndex = 6 Then
Else
s = "A" & i & ":B" & i
Range(s).Delete Shift:=xlUp
End If
Next
Application.ScreenUpdating = True
End Sub

--
Gary''s Student - gsnu200758


"Patrick Bateman" wrote:

AWESOME!!

cheers thats a great idea! only problem is it seems to keep repeating for
ages?

"Gary''s Student" wrote:

For example:

Sub movit()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Range("A:B").Copy s2.Range("A1")
s2.Activate

n = Cells(Rows.Count, "A").End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, "A").Interior.ColorIndex = 6 Then
Else
s = "A" & i & ":B" & i
Range(s).Delete Shift:=xlUp
End If
Next
End Sub

First all the data is copied and then the non-yellow data is reomved.
--
Gary''s Student - gsnu200758


"Patrick Bateman" wrote:

hi,

is seem to be going round in circles with this one and wandrered if you can
help?

i have two columns of data say A and B and some of the cells in column a are
coloured yellow
i am trying to write a macro that makes 2 new columns of data on a new sheet
for all the rows that have a cell in column a coloured yellow

any help or ideas would be much appreciated

thankyou

patrick

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default move formatted cells

Not trivial.. See:

http://groups.google.com/group/micro...768bb674d58088
--
Gary''s Student - gsnu200758


"Patrick Bateman" wrote:

i have an additional problem that has cropped up.......

the coloured cells are coloured because of conditional formatting and this
causes problems when the cells are coppied and deleted.

any ideas how to get round it? is it possible to remove the conditional
formatting but keep the cells coloured?

"Gary''s Student" wrote:

Well then, let's try a version that may be a bit faster:

Sub movit()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Range("A:B").Copy s2.Range("A1")
s2.Activate

n = Cells(Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = n To 1 Step -1
If Cells(i, "A").Interior.ColorIndex = 6 Then
Else
s = "A" & i & ":B" & i
Range(s).Delete Shift:=xlUp
End If
Next
Application.ScreenUpdating = True
End Sub

--
Gary''s Student - gsnu200758


"Patrick Bateman" wrote:

AWESOME!!

cheers thats a great idea! only problem is it seems to keep repeating for
ages?

"Gary''s Student" wrote:

For example:

Sub movit()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Range("A:B").Copy s2.Range("A1")
s2.Activate

n = Cells(Rows.Count, "A").End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, "A").Interior.ColorIndex = 6 Then
Else
s = "A" & i & ":B" & i
Range(s).Delete Shift:=xlUp
End If
Next
End Sub

First all the data is copied and then the non-yellow data is reomved.
--
Gary''s Student - gsnu200758


"Patrick Bateman" wrote:

hi,

is seem to be going round in circles with this one and wandrered if you can
help?

i have two columns of data say A and B and some of the cells in column a are
coloured yellow
i am trying to write a macro that makes 2 new columns of data on a new sheet
for all the rows that have a cell in column a coloured yellow

any help or ideas would be much appreciated

thankyou

patrick

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
formatted cells medina Excel Worksheet Functions 0 April 16th 10 04:29 PM
Formatted cells Nenagh Excel Discussion (Misc queries) 2 March 22nd 07 09:25 AM
Protecting formatted cells. Peter Ostermann[_3_] Excel Programming 3 April 29th 06 04:18 AM
Too many formatted cells XROCKYISBACKX Excel Discussion (Misc queries) 1 December 4th 05 05:44 PM
Converting 'General' formatted cells to Text formatted cell using. Zahid Khan Excel Worksheet Functions 1 March 12th 05 07:13 PM


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