Closed

excel macro to change file name based on column data -- 2

I have an existing macro that is pulling row data from main register file and modifying a different template file that is associated with the row entry. The macro is pasted down below and is working perfectly fine, no need to fix anything related to it !! So I just want to add a simple feature, I want it to also rename the file from Bla Bleh to a format based on the excel rows, so the new name will be "column O" "Column C" "First 2 words from column E" "the word Rev" "Column M" I hope it is clear for you. Please do not bid if you are not experienced - I don't like to keep testing wrong macro Existing macro is below:

Public Const template_file = "Bla [login to view URL]"

Public Const template_sht = "E-01"

 

Sub Fill_Template()

    Dim pj_title As String, pj_no As Variant, xa2 As Variant

    Dim xa3 As String, xa4 As String, rev As String, zdate As Variant, ref As Variant

    Dim cur As Long

    Dim main As Worksheet

    Dim path_count, path

    Dim template As Workbook, temp_sht As Worksheet, sht As Worksheet, sht_OK As Boolean

   

    On Error GoTo exit_sub

   

    With Application

        .ScreenUpdating = False

        .DisplayAlerts = False

    End With

   

    cur = [login to view URL]

    Set main = ActiveSheet

   

    'Check if the path is existed or not

    path_count = [login to view URL]("O" & cur).[login to view URL]

    If path_count = 0 Then

        MsgBox "No path in select cell O" & cur & " !", vbInformation

        GoTo exit_sub

    Else

    If Left([login to view URL]("O" & cur).Hyperlinks(1).Address, 1) = "." Then

        path = [login to view URL] & "\" & [login to view URL]("O" & cur).Hyperlinks(1).Address & "\" & template_file

    Else

            path = [login to view URL]("O" & cur).Hyperlinks(1).Address & "\" & template_file

    End If

    End If

   

    If Dir(path) = "" Then

        MsgBox "Check the template path !", vbInformation

       GoTo exit_sub

    End If

   

    'put information

   

    With main

        pj_title = .Range("E" & cur).Value

        pj_no = .Range("C" & cur).Value

        xa2 = .Range("D" & cur).Value

        xa3 = .Range("G" & cur).Value

        xa4 = .Range("F" & cur).Value

        rev = .Range("M" & cur).Value

        zdate = .Range("N" & cur).Value

        ref = .Range("O" & cur).Value

    End With

   

    'Fill into template

    sht_OK = False

    Set template = [login to view URL](path, ReadOnly:=False)

    For Each sht In [login to view URL]

        If [login to view URL] = template_sht Then

            sht_OK = True

            Set temp_sht = sht

            Exit For

        End If

    Next sht

   

    If sht_OK = False Then

        MsgBox "Check the template sheet name !", vbInformation

        [login to view URL] savechanges:=False

        GoTo exit_sub

    End If

   

    With temp_sht

        .Range("D5").Value = pj_title

        .Range("D6").Value = pj_no

        .Range("J6").Value = xa2

        .Range("J11").Value = xa3

        .Range("H13").Value = xa4

        .Range("J13").Value = rev

        .Range("J15").Value = zdate

        .Range("J16").Value = ref

       

        [login to view URL]

        [login to view URL]

    End With

   

    MsgBox "Completed !", vbInformation

   

exit_sub:

 

    With Application

        .ScreenUpdating = True

        .DisplayAlerts = True

    End With

   

End Sub

Skills: Visual Basic, Data Processing, Data Entry, Excel, Visual Basic for Apps

See more: excel macro change cell contents, excel macro cut paste based cell value, excel macro reading file, excel rename files in a folder, change file names based on excel, excel vba rename files based on list, python rename multiple files from excel list, excel macro rename file, rename multiple files using excel vba, excel macro to rename multiple files in a folder and subfolders, how to rename folders using excel, excel macro charge fee based time, excel macro formating file, excel macro import file parse data, excel macro return file names directory, excel macro paste file directory, excel macro export file, excel macro list file names directory, excel macro flat file, excel macro cut paste based column value

About the Employer:
( 150 reviews ) Doha, Qatar

Project ID: #27919375

20 freelancers are bidding on average $23 for this job

(299 Reviews)
7.2
(180 Reviews)
6.6
(114 Reviews)
5.9
mail2vimalarora

Hello, I am ready to discuss project with you. Being experienced in working on several Excel Macro projects of various complexities, based on that I can help you in adding changes you want in existing VBA code. I am a More

$20 USD in 1 day
(117 Reviews)
6.0
expertatwork

Hi there - Thanks for the heads-up on the macro, I can implement this simple feature. Please reply, we can discuss further and hopefully get it started soon. Thank you!

$30 USD in 1 day
(213 Reviews)
6.1
ilkecokay

I will do this for you for the lowest price possible. We can rename the template in any way you want. Message for most fair price! Regards.

$10 USD in 1 day
(58 Reviews)
5.3
writingapp

Hi. I have written many automation Excel VBA macros. Ready to write your project. Will complete within some hours

$25 USD in 1 day
(72 Reviews)
5.6
maguirrer

Hello, I can help you to add the new code, please send me a message with more details of how to get the new name of the sheet, and I can start working on it inmediately

$22 USD in 1 day
(37 Reviews)
4.3
rameshraja86

I can rename file from VBA based on column fields Please contact me to start discussion and work Thanks

$30 USD in 1 day
(16 Reviews)
4.0
FaiziTechy

Hi, I am Excel VBA expert having 7+ years of experience My works includes: 1. Project Dashboards, Employee tracker 2. Userforms, Automated calculations, pivots and graphs 3. Data consolidation using macro. 4. Sha More

$15 USD in 1 day
(1 Review)
2.8
Davzone

Hi, I think I didnt undesrtand this part verry well :column O" "Column C" "First 2 words from column E" "the word Rev" "Column M", are column O , column C, column M refering to the complete content of the cell?, if it More

$25 USD in 1 day
(2 Reviews)
2.2
arunodaya123

HI hope you doing well, I am qualified and experienced senior VBA/RPA Developer having 12+ years of experience in developing automation projects. I Understand your requirement and I can give my full effort to deliver More

$15 USD in 7 days
(3 Reviews)
1.8
absrads

Hello, I think I understand what you are trying to do here. However, to get more clarity, could you please post a sample file that has the input and the desired output? This would make the task more clear and would e More

$30 USD in 7 days
(2 Reviews)
1.9
chnsci

Greetings, I think here you are looking for someone to work on excel macro to change file name based on column data. I understood your project description. I am an expert in Visual Basic, Data Entry, Excel, Visual More

$20 USD in 1 day
(3 Reviews)
1.8
vw8305776vw

Hello! I have more than 22 years of software development experience in Visual Basic (VB6, VB.NET and VBA). I'm very interested in this project. I can help you out right now. I'm able to do a fast and accurate job for y More

$30 USD in 2 days
(1 Review)
1.2
lizhrglobal

Hi Thanks for your post. I am excited to look at your project, because Excel Macro is my good skills. I have already finished several Macro projects such as your project. You can check this on my profile. If you want t More

$20 USD in 1 day
(1 Review)
1.3
myzulhilmi

Assalamualaikum and greetings, Looking through at the macro pasted, and the new requirement you want to add to it, I believe I can deliver as per your requirement precisely. I worked with a Multi Nasional Company bef More

$20 USD in 2 days
(0 Reviews)
0.0
AkmalAziz32

Hi, I am good at using MS word MS excel MS PowerPoint. I am also easy to communicate. I just want to say that you must regret not choosing me. Thank you.

$18 USD in 7 days
(0 Reviews)
0.0
svferey

Hi, This will generate the new filename based on your requirements. The only issue is whether you want the template actually renamed or the updated version saved as a new 'backup' file. 'Generate the New FileNam More

$25 USD in 1 day
(0 Reviews)
0.0
lizmering30

i have years experienced in excel and able to work minimal supervision. i work best in charts and graphs.

$20 USD in 7 days
(0 Reviews)
0.0