+ Reply to Thread
Results 1 to 3 of 3

Msgbox show selection

Hybrid View

sgp Msgbox show selection 01-16-2012, 09:34 AM
Bmoe Re: Msgbox show selection 01-16-2012, 09:52 AM
sgp Re: Msgbox show selection 01-16-2012, 10:05 AM
  1. #1
    Forum Contributor
    Join Date
    10-28-2011
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    114

    Question Msgbox show selection

    Hi

    I'm trying to incorparate a code into the msgbox which shows the selection made - which is the value in C5 - before the information is transfered across.

    I have seen some examples but i've not been able to get this to work in my code below:


    Sub SaveSiteDetails()
    If MsgBox("Do you want to save it now?", vbYesNo + vbQuestion, "Confirm Site Details") = vbYes Then
    
    Dim sventr, r As Range
    sventr = Array([C5].Value, [C7].Value, [C9].Value, [C11].Value, [C13].Value, [C15].Value, [H5].Value, [G7].Value, [G9].Value, [G11].Value, [G13].Value, [G15].Value, _
                   [L8].Value, [O8].Value, [P8].Value, [R8].Value, [S8].Value, [T8].Value, [U8].Value, [L9].Value, [O9].Value, [P9].Value, [R9].Value, [S9].Value, [T9].Value, [U9].Value, [L10].Value, [O10].Value, [P10].Value, [R10].Value, [S10].Value, [T10].Value, [U10].Value, [L11].Value, _
                   [C19].Value, [C21].Value, [C23].Value, [C25].Value, [C27].Value, [C29].Value, [C31].Value, [G19].Value, [G21].Value, [G23].Value, [G25].Value, [G27].Value, [G29].Value, [G31].Value, _
                   [M19].Value, [M21].Value, [M23].Value, [M25].Value, [M27].Value, [M29].Value, [M31].Value, [M33].Value, [M35].Value, [S19].Value, [S21].Value, [S23].Value, [S25].Value, [S27].Value, [S29].Value, [S31].Value, [S33].Value, _
                   [C40].Value, [AG8].Value, [AG9].Value, [AG10].Value, [AG11].Value, [AG12].Value, [AG13].Value, [AG14].Value, [AG16].Value, [AG17].Value, [AG18].Value, [AG19].Value, [AG20].Value, [AG21].Value, [AG22].Value, [AG23].Value, [AG24].Value, [AG25].Value, [AG26].Value, [AG28].Value, [AG29].Value, [AG30].Value, [AG31].Value, [AG32].Value, [AG33].Value, [AG34].Value, [AG35].Value, [AG37].Value, [AG38].Value, [c50].Value)
                   
                  
                   
    With Sheets("ALL_SITES")
        Set r = .Range("C12:C200" & .Cells(Rows.Count, 2).End(xlUp).Row).Find(What:=sventr(0), LookAt:=xlWhole)
        If Not r Is Nothing Then r.Resize(, 95).Value = sventr: .Activate
    End With
    
    Else
        ' Do nothing
         
    End If
    
    End Sub

    Thanks
    Last edited by sgp; 01-16-2012 at 10:04 AM.

  2. #2
    Registered User
    Join Date
    04-19-2010
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Msgbox show selection

    Depending on where you want to put the value;

    If MsgBox("Do you want to save it now?" & vbCrLF & "Value: " & ActiveSheet.Range("C5").value, vbYesNo + vbQuestion, "Confirm Site Details") = vbYes Then
    or

    If MsgBox("Do you want to save it now?" & vbCrLF & "Value: " & Selection.Value, vbYesNo + vbQuestion, "Confirm Site Details") = vbYes Then

    vbCrLf is a constant that adds a "CrLf = carriage return, line feed"
    Last edited by Bmoe; 01-16-2012 at 09:56 AM.
    Excel\Access, VBA, C#, C++, SQL, Java

  3. #3
    Forum Contributor
    Join Date
    10-28-2011
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Msgbox show selection

    Thanks a lot!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1