Sheet name=Cell value

M

Mahal

Hey Everyone,

Here's what I'm trying to do:
If a cell value from one sheet equals another sheet name, I want to enter a value from a cell adjacent to the first cell into the worksheet with the same name. I don't really know where to start.

Any help would be greatly appreciated!

M
 
S

Subodh

Hey Everyone,



Here's what I'm trying to do:

If a cell value from one sheet equals another sheet name, I want to enter a value from a cell adjacent to the first cell into the worksheet with the same name. I don't really know where to start.
The following code will active a subroutine on workbook_open event. I hope this helps.

Private Sub Workbook_Open()
If ThisWorkbook.Worksheets("Sheet1").Range("A1").Value = ThisWorkbook.Worksheets("Sheet2").Name Then
ThisWorkbook.Worksheets("Sheet1").Range("A1") = ThisWorkbook.Worksheets("Sheet2").Range("A1")
End If

End Sub
 
S

Subodh

The following code will active a subroutine on workbook_open event. I hope this helps.



Private Sub Workbook_Open()

If ThisWorkbook.Worksheets("Sheet1").Range("A1").Value = ThisWorkbook.Worksheets("Sheet2").Name Then

ThisWorkbook.Worksheets("Sheet1").Range("A1") = ThisWorkbook.Worksheets("Sheet2").Range("A1")

End If



End Sub
Find the following amended code...................

Private Sub Workbook_Open()
If ThisWorkbook.Worksheets("Sheet1").Range("A1").Value = ThisWorkbook.Worksheets("Sheet2").Name Then
ThisWorkbook.Worksheets("Sheet2").Range("A1").Value = ThisWorkbook.Worksheets("Sheet1").Range("A1").Value
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top