Showing posts with label cell. Show all posts
Showing posts with label cell. Show all posts

Monday, March 14, 2016

How to add hyperlinks for macro call outs in EXCEL VBA

This program will create hyperlinks that link to their own cell in excel, it is then easy to use these hyperlinks to create macros (see blog post http://domyexcelblog.blogspot.com/2016/03/how-to-run-macro-from-hyperlink-event.html ) :

Sub Add_Hyperlinks_for_macros()

For i = 6 To 200
    If Cells(i, 5) <> "" Then
                ActiveSheet.Cells(i, 5).Select
                ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
                    "'My Contacts'!e" & i, TextToDisplay:="Add Photo"
    End If
Next

End Sub




Created by DoMyExcel.com © | Excel & VBA Consulting | Customized Excel Solutions starting at 29 USD
Services provided to Individuals and Businesses | Free Quote: DoMyExcel@gmail.com

Video example: Import and size pictures in EXCEL VBA

This video show an example of contact file where up to 30 profiles can be added with profile info and autosized profile pic.




Created by DoMyExcel.com © | Excel & VBA Consulting | Customized Excel Solutions starting at 29 USD
Services provided to Individuals and Businesses | Free Quote: DoMyExcel@gmail.com

Sunday, February 7, 2016

How to go to formulas references in Excel

To access Excel formulas' references of a selected cell, you first need to trace the formula dependents in Formulas tab > Trace Dependents button.
dependent arrows
The blue arrows will show the dependent cells:
blue arrows
If there is a dotted arrow it means the cell is linked to another sheet's cell or another file's cell. Double click on the arrow to navigate to the reference cell:
trace dependents sheet
A Go To dialog box will pop up: Select the reference and click OK to jump to that specific cell:
go to sheet

Created by DoMyExcel.com © | Excel & VBA Consulting | Customized Excel Solutions starting at 29 USD
Services provided to Individuals and Businesses | Free Quote: DoMyExcel@gmail.com
 EXCEL Consulting - FREE Estimate!

Saturday, September 5, 2015

How to modify the reference cell in an Excel formula using the indirect function

The "indirect" function allows to decompose your formula and enter the reference cells outside of the formula.

For example if you want to multiply the cells A1 per 10 then you can write the text "A1" in a separate cell  (in C1 in the example below) and then simply enter the formula:

=INDIRECT(C1)*10




This function is particularly interesting if you want to apply a certain logic on the reference cells and to control them "outside" of the formula.
The example below show how to retrieve the value of cells A1s of each sheet of the workbook: enter the sheet names in column A, the cells reference in column B and enter the formula:




=INDIRECT(A3&"!"&B3)

Created by DoMyExcel.com © | Excel & VBA Consulting | Customized Excel Solutions starting at 29 USD
Services provided to Individuals and Businesses | Free Quote: DoMyExcel@gmail.com

Thursday, March 20, 2014

How to anchor a shape to fit with an Excel cell


Control the size of the shape to match with cell size


When inserting a shape in an Excel spreadsheet (menu “Insert” > “Shapes”), hold “ALT” to lock in your shape within the multi cell selection.


Sunday, March 16, 2014

How to lookup a specific word or value in a cell or an Excel database using the VBA function Instr()

Four examples to understand the function Instr() on VBA:


Example 1: Instr() return the position of a character in a word

Sub function_instr()
'Instr syntax: InStr( [start], string, substring, [compare] )
'VBA Excel search the position of a character in a word - integer
'ex 1: check at what position is the letter x contained in word "domyexcel.com"

result_ex1 = InStr("domyexcel.com", "x")
MsgBox ("character x is at the " & result_ex1 & "th position in the world domyexcel.com")

End sub

Example 2: Instr() presence of a character in a word (True or False)

Sub function_instr()
'VBA Excel check if a letter is included in a word - true or false
'ex 2: check if yes or no the letter x contained in word "domyexcel.com"

If InStr("domyexcel.com", "x") > 0 Then
result_ex2 = True
MsgBox ("letter x is included in domyexcel.com")
Else
result_ex2 = False
MsgBox ("letter x is not included in domyexcel.com")
End If

End Sub

Example 3: Instr() presence and location of a word in a database

Sub function_instr()
'VBA Excel search if a world is contained in a database:
'ex3: tell at which line of the database the world "domyexcel" was found

For i = 1 To 10
    If InStr(Cells(i, 1), "domyexcel.com") > 0 Then
    result_ex3 = i
    MsgBox ("The word domyexcel.com was found at row " & result_ex3)
    End If
Next

End Sub

Example 4: Instr() Highlight the cell in a database that contain a specific character or word

Sub function_instr()
'VBA Excel highlight the cells in a database that contained a specific word a/o character
'ex4: highlight in blue the cells that contain the character x

For i = 1 To 10
    If InStr(Cells(i, 4), "x") > 0 Then
    Cells(i, 4).Select
    Selection.Interior.Color = 16750899
    End If
Next

End Sub


Code syntax: charles.racaud.free.fr