Macro Help

zbiris

New Member
Joined
Apr 24, 2019
Messages
7
Hello,

I need help from the experts.

I'm creating an inventory file for all users and I have the main sheet called "Users" where I have a table with the names of the users in the column A, starting in the cell A1 and goes to A200.

I need to create a new sheet using the sheet called "Template" with the name of the cell.

And after that I need that the text in the cell A1 goes to the cell C4 on the new sheet created.

Can you help me please?
 
The values from col

A B C D
[TABLE="width: 262"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]User1[/TD]
[TD]Test1[/TD]
[TD]Access1[/TD]
[TD]Confirmation1[/TD]
[/TR]
[TR]
[TD]User2[/TD]
[TD]Test2[/TD]
[TD]Access2[/TD]
[TD]Confirmation2[/TD]
[/TR]
[TR]
[TD]User3[/TD]
[TD]Test3[/TD]
[TD]Access3[/TD]
[TD]Confirmation3[/TD]
[/TR]
</tbody>[/TABLE]

Want the sheet User1 to have the User1 text in the cell c4 the Test1 in the cell H4 text Access1 in the cell H6 and text Confirmation1 in cell D6 and forwards. User2 data in the sheet User2
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
In that case, try
Code:
Sub zbiris()
   Dim Cl As Range
   
   For Each Cl In Sheets("Users").Range("A1", Sheets("Users").Range("A" & Rows.count).End(xlUp))
      If Cl.Value <> "" Then
         If Not Evaluate("isref('" & Cl.Value & "'!A1)") Then
            Sheets("Template").Copy , Sheets(Sheets.count)
            With ActiveSheet
               .Name = Cl.Value
               .Range("C4").Value = Cl.Value
               .Range("H4").Value = Cl.Offset(, 1).Value
               .Range("H6").Value = Cl.Offset(, 2).Value
               .Range("D6").Value = Cl.Offset(, 3).Value
            End With
         End If
      End If
   Next Cl
End Sub
 
Upvote 0
In that case, try
Code:
Sub zbiris()
   Dim Cl As Range
   
   For Each Cl In Sheets("Users").Range("A1", Sheets("Users").Range("A" & Rows.count).End(xlUp))
      If Cl.Value <> "" Then
         If Not Evaluate("isref('" & Cl.Value & "'!A1)") Then
            Sheets("Template").Copy , Sheets(Sheets.count)
            With ActiveSheet
               .Name = Cl.Value
               .Range("C4").Value = Cl.Value
               .Range("H4").Value = Cl.Offset(, 1).Value
               .Range("H6").Value = Cl.Offset(, 2).Value
               .Range("D6").Value = Cl.Offset(, 3).Value
            End With
         End If
      End If
   Next Cl
End Sub

That's perfect, thanks
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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