Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8007327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:47:18+00:00 2026-06-04T17:47:18+00:00

I have this code I’m working with, to make it Mac/PC complaint with help

  • 0

I have this code I’m working with, to make it Mac/PC complaint with help from here, but after this is done running on my PC at least for now, I have created a folder with a company name, and part number folder for later use.

Sub MakeFolder()

Dim strComp As String, strPart As String, strPath As String

strComp = Range("A1") ' assumes company name in A1
strPart = CleanName(Range("C1")) ' assumes part in C1
strPath = "C:\Images\"

If Not FolderExists(strPath & strComp) Then 
'company doesn't exist, so create full path
    FolderCreate strPath & strComp & "\" & strPart
Else
'company does exist, but does part folder
    If Not FolderExists(strPath & strComp & "\" & strPart) Then
        FolderCreate strPath & strComp & "\" & strPart
    End If
End If

End Sub

Function FolderCreate(ByVal path As String) As Boolean

FolderCreate = True
Dim fso As New FileSystemObject

If Functions.FolderExists(path) Then
    Exit Function
Else
    On Error GoTo DeadInTheWater
    fso.CreateFolder path 
    Exit Function
End If

DeadInTheWater:
    MsgBox "A folder could not be created for the following path: " & path & ". Check the path name and try again."
    FolderCreate = False
    Exit Function

End Function

Function FolderExists(ByVal path As String) As Boolean

FolderExists = False
Dim fso As New FileSystemObject

If fso.FolderExists(path) Then FolderExists = True

End Function

Function CleanName(strName as String) as String
'will clean part # name so it can be made into valid folder name
'may need to add more lines to get rid of other characters

    CleanName = Replace(strName, "/","")
    CleanName = Replace(CleanName, "-","")
    etc...

End Function

Now what I am attempting to do is make it so that if said Customer exists, and SO# Folder Exists, to create a link to it in P. on the same row.

Now as shown below the path is C:\Images\Company Name\SO#\

The link I’d like to have would say in the representing row would be Pictures for “SO#” the SO# would be replaced with the SO# of the row itself. Then when you click on it, the link brings you to the folder in Explorer.

Theoretically I could make it so that the code looks like this, but I’m not sure entirely…

Option Explicit

Sub Create_a_Link()

    Dim wsJAR As Worksheet 'JL Archive
    Dim lastrow As Long, fstcell As Long
    Set wsJAR = Sheets("JL Archive")

    With Application
        .ScreenUpdating = False
        .DisplayAlerts = False
        .EnableEvents = False
    End With

     With JAR
        lastrow = wsJAR.Cells(Rows.Count, "P").End(xlUp).Row
        Range("P3:P" & lastrow).Value = Hyperlink("C:\$C3:C" & lastrow \" & "B3:B" & lastrow, "Cellname")
    End With

    With Application
        .ScreenUpdating = True
        .DisplayAlerts = True
        .EnableEvents = True
    End With

but I keep getting an error here:

   Range("P3:P" & lastrow).Value = Hyperlink("C:\$C3:C" & lastrow \" & "B3:B" & lastrow, "Cellname")

Says a compile error: Expected list separator or )

If anyone can help it be appreciated…Attached is the excel sheet.

https://dl.dropbox.com/u/3327208/Excel/picture.xlsx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:47:20+00:00Added an answer on June 4, 2026 at 5:47 pm

    The problem here is that you don’t have the right syntax to create a hyperlink. I used the macro recorder to see the code to add a hyperlink to a sheet. I also googled “Excel VBA add hyperlink to range”. The resulting sytax is below:

    ActiveSheet.Hyperlinks.Add Anchor:=myRange, Address:= myPath, TextToDisplay:= myText
    
    myRange = the place you want the hyperlink to go
    myPath = the path of the hyperlink
    myText = the text you want to display
    

    Here I gave you your answer, but also, how to best go about finding your own answer in the future. Learning how to search for answers is half the battle of learning how to code in VBA!

    ** EDIT **

    Also, you can’t set the whole range at once. You have to loop through rows and add each hyperlink separately. Otherwise, you can add the hyperlink when you create the job (take from past convos.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code I found but it doesnt work even after i tried
I have this code here, which is intended to allow any type of arguments:
I have this code in my forms.py : from django import forms from formfieldset.forms
I have this code which export data from GridView to csv. It works with
I have this code: http://jsfiddle.net/bUPWS/1/ but #div2 overflows #div1. How to bring the overflowed
I have this code: IList<Foo1> ou = session.CreateQuery(from Foo1 as f1 JOIN FETCH f1.foo2
I have this code that I have written in Ruby, but when trying to
I have this code to create a config.ini file with Zend Framework but I
I have this code: public function getRecurringEventsByGrouped($grouped){ $query = SELECT * FROM `event` AS
I have this code but it doesn't work! public class Trial { public static

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.