Copy cell to a new sheet on same place

elmnas

Board Regular
Joined
Feb 20, 2015
Messages
206


Hi guys Could someone help me,

I use this the variable: FindCol_RowID="sv" (that is the search string the script looking for in a sheet)

then in the msgbox I get the ID of the cell

but could someone help me to

paste the cell + column into a new sheet on the same place?

See code below:

Dim FindCol_RowID As String
Dim aCell As Range


FindCol_RowID = "sv"


Set aCell = Sheet1.Rows(1).Find(What:=FindCol_RowID, LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)


If Not aCell Is Nothing Then
MsgBox "the Cell is" & aCell.Address


Thank you in advance

 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Where is the new sheet? Assuming the new sheet is "Sheet 2" in the same workbook, just add one line:

Code:
[COLOR=#333333]If Not aCell Is Nothing Then[/COLOR]
[COLOR=#333333]MsgBox "the Cell is" & aCell.Address
[/COLOR]ThisWorkbook.Sheets(2).Cells(aCell.Row, aCell.Column).Value = aCell.Value
End If
 
Upvote 0
thanks man,

Here is my code,

Could you help me to fit your code in my code? I dont get it work

Thank you in advance

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








sht.Cells(MyCell.Row, MyRange.Columns(2).Column).Copy




'MsgBox "Language is: " & MyCol.Cells(1, 1).Text
 Dim objSheet As Worksheet
For Each objSheet In ActiveWorkbook.Sheets
   If objSheet.Name = MyCol.Cells(1, 1).Text Then
        End 'MsgBox "A worksheet with that name already exists."
 Worksheets(MyCol.Cells(1, 1).Text).Activate
    End If
      Next objSheet
      
      
       Worksheets.Add
       
       
       
       
       
       
       
       
       
        
     '   MsgBox "hej"
        






        
    ActiveSheet.Name = MyCol.Cells(1, 1).Text




    
            End If
        Next
    Next
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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