New to VBA - Copy paste template if cell contains certain value

New_Excel_VBA_User

New Member
Joined
Mar 3, 2020
Messages
19
Office Version
  1. 2016
Platform
  1. Windows
Hi everyone,

This is kind of like asking someone to tell me about the Universe, but i'm new to VBA and have been looking into it more (purchasing books) to get started as I'm seeing a massive need to help with my daily job functions. One I'm primarily looking at is trying to copy a template worksheet and renaming based on (Column A) if Column (AN contains "Yes"); this is updated on a monthly basis so I would also need to have it not attempt to replace a tab or use the name if it already has created a tab. So my questions are is this task possible? What would be the best way for a newbie to start?

Thanks.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
I'm getting a compiler error "only comments may appear after End Sub" and it is highlighting the following (sorry my ignorance on the subject I'm not sure what to modify).

Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
 
Upvote 0
WOW!!! Y I appreciate the help. VBA language is very different for me (sql and ACL syntx experience) so it looks very different to me and I couldn't have done this yet.

Thanks!
 
Upvote 0
WOW!!! Y I appreciate the help. VBA language is very different for me (sql and ACL syntx experience) so it looks very different to me and I couldn't have done this yet.

Thanks!
Welcome! Glad to help! :)
 
Upvote 0
Sorry one last question; when adding to the file and the copy of the template is created and named ActiveSheet.Name = "newSheetName" is there a way to modify to name based on column A in the input data tab? ActiveSheet.Name = worksheets."Inventory".Range(A:A) or would that not work?
 
Upvote 0
It already does by the name passed to that function which is copySheet(Cells(Target.Row, 1)) that 1 = Column A
 
Upvote 0
Cool. I'll look back and try again, i may have did something as its currently renaming all of mine to Template (1), (2) etc.
Thanks again for all the help!
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,824
Members
449,190
Latest member
rscraig11

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