How t loop through all columns and create a sheet of each specific sheet

elmnas

Board Regular
Joined
Feb 20, 2015
Messages
206
Hi guys,

I have created following code,

the code looks for a certain value of a colorINDEX=23

I got a Msgbox that tells me the correct value of a certain cell, then I recieve the first cell in the column,

now I need a loop through all columns in each sheet,
then create new sheets with name of each certain value I recieve from the certain cell



see my code below




Code:
Sub Langauge_Combination()




For Each sht In ActiveWorkbook.Worksheets
Set Rng = sht.UsedRange
Set MyRange = Rng


For Each MyCol In MyRange.Columns
For Each Mycell In MyCol.Cells








'MsgBox ("Address: " & MyCell.Address & Chr(10) & "Value: " & MyCell.Value)


If Mycell.Interior.ColorIndex = 23 Then


MsgBox "Language is: " & MyCol.Cells(1, 1).Text 'When the loops go throughs I get this value, I want this value for each new sheet
'and if the sheet is created in the first time loop then go to next.




'MsgBox "" & Mycell.Column
'Cells(Mycell.Row, 2).Copy
'Mycell.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
'SkipBlanks:=False, Transpose:=False
    
            End If
        Next
    Next
Next




End Sub


Thank you in advance
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,215,061
Messages
6,122,922
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top