Auto incrementing a network path

chandel

New Member
Joined
Nov 30, 2017
Messages
3
Hi
Need help with auto incrementing a network path in excel 2010...
for example: column B contains a random list of numbers starting at cell B2 and going upto B101:
A B C D E
1
2 234
3 239
4 111
5 553
6 312
7 876
8 232
9 121
. .
. .
. .
101 466

I want to assign a hyperlink "\\10.23.22.11\photo\images\pic001.jpg" to the first number '234' in cell B2, which i did.
But then i want to auto fill the hyperlink to the subsequent cells and not insert them one by one for each number. i.e. while using the auto fill i want to increase the path's pic number by 1 in the successive hyperlinks like pic002.jpg, pic003.jpg...pic100.jpg so that each number is linked with an hyperlink as follows...
234 linked with \\10.23.22.11\photo\images\pic001.jpg
239 linked with \\10.23.22.11\photo\images\pic002.jpg
111 linked with \\10.23.22.11\photo\images\pic003.jpg
553 linked with \\10.23.22.11\photo\images\pic004.jpg
.
.
.
466 linked with \\10.23.22.11\photo\images\pic100.jpg

Thanks in advance for any help on this.
 

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,214
Office Version
365
Platform
Windows
I want to assign a hyperlink "\\10.23.22.11\photo\images\pic001.jpg" to the first number '234' in cell B2, which i did.
Hi, welcome to the forum!

Here is another option, first remove your manually created hyperlink and in it's place use the formula in B2 and copy it down.

<b>Excel 2013/2016</b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style="text-align: right;;">234</td><td style="text-decoration: underline;color: #0563C1;background-color: #FFFF00;;">\\10.23.22.11\photo\images\pic001.jpg</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style="text-align: right;;">239</td><td style="text-decoration: underline;color: #0563C1;;">\\10.23.22.11\photo\images\pic002.jpg</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style="text-align: right;;">111</td><td style="text-decoration: underline;color: #0563C1;;">\\10.23.22.11\photo\images\pic003.jpg</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style="text-align: right;;">553</td><td style="text-decoration: underline;color: #0563C1;;">\\10.23.22.11\photo\images\pic004.jpg</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">6</td><td style="text-align: right;;">312</td><td style="text-decoration: underline;color: #0563C1;;">\\10.23.22.11\photo\images\pic005.jpg</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">7</td><td style="text-align: right;;">876</td><td style="text-decoration: underline;color: #0563C1;;">\\10.23.22.11\photo\images\pic006.jpg</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">8</td><td style="text-align: right;;">232</td><td style="text-decoration: underline;color: #0563C1;;">\\10.23.22.11\photo\images\pic007.jpg</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">9</td><td style="text-align: right;;">121</td><td style="text-decoration: underline;color: #0563C1;;">\\10.23.22.11\photo\images\pic008.jpg</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">B2</th><td style="text-align:left">=HYPERLINK(<font color="Blue">"\\10.23.22.11\photo\images\pic"&TEXT(<font color="Red">ROWS(<font color="Green">B$2:B2</font>),"000"</font>)&".jpg"</font>)</td></tr></tbody></table></td></tr></table><br />
 

chandel

New Member
Joined
Nov 30, 2017
Messages
3
Thanks mole999 and FormR for your prompt replies. I appreciate.
FormR's solution got me quite close to what i actually wanted. Thanks for that FormR.
Though still unable to include this hyperlink progressively to the numbers in cell A.
But again if that can't be done it would be fine as i can sustain with FormR's answer.
Thanks again guys.
 

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,214
Office Version
365
Platform
Windows
Though still unable to include this hyperlink progressively to the numbers in cell A.
Hi, if you want the hyperlinks in the same cell as the list of random numbers then you can try this macro to add them.

Assumes your list is in column A starting on row 2.

Rich (BB code):
Sub AddHLinks()
Dim i As Long
For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
  If Len(Range("A" & i).Value) Then
    ActiveSheet.Hyperlinks.Add Anchor:=Range("A" & i), Address:="\\10.23.22.11\photo\images\pic" & Format(i - (2-1), "000") & ".jpg", _
    TextToDisplay:=CStr(Range("A" & i).Value)
  End If
Next i
End Sub
 

chandel

New Member
Joined
Nov 30, 2017
Messages
3
Hi, if you want the hyperlinks in the same cell as the list of random numbers then you can try this macro to add them.

Assumes your list is in column A starting on row 2.

Rich (BB code):
Sub AddHLinks()
Dim i As Long
For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
  If Len(Range("A" & i).Value) Then
    ActiveSheet.Hyperlinks.Add Anchor:=Range("A" & i), Address:="\\10.23.22.11\photo\images\pic" & Format(i - (2-1), "000") & ".jpg", _
    TextToDisplay:=CStr(Range("A" & i).Value)
  End If
Next i
End Sub

Thanks much FormR...worked like a charm. Appreciate your help.
 

Forum statistics

Threads
1,081,751
Messages
5,361,082
Members
400,612
Latest member
mr_sound

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top