Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default send value to a cell instead on MsgBox

I am using a countIf statement to count occurances of certain values
right now they are being displayed in a MsgBox but i want to have th
value pasted into a specific cell instead of the MsgBox. Below is th
code that I have so far. Can someone tell me the easiest way to mak
this change.
----------------------------------------------------------
Private Sub S350btn_Click()

Dim S350 As String
Dim Gate1 As String
Dim Gate2 As String
Dim Gate4 As String

S350 = "350"
Gate1 = "Gate 1"
Gate2 = "Gate 2"
Gate4 = "Gate 4"

MsgBox Application.CountIf(Range("B:B"), "*" & S350 & "*" & "*"
Gate1 & "*"), , "S350 Gate 1"

MsgBox Application.CountIf(Range("B:B"), "*" & S350 & "*" & "*"
Gate2 & "*"), , "S350 Gate 2"

MsgBox Application.CountIf(Range("B:B"), "*" & S350 & "*" & "*"
Gate4 & "*"), , "S350 Gate 4"

End Sub

--------------------------------------------------------------

Thank you

Morr

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default send value to a cell instead on MsgBox

Hi
try something like
activesheet.range("A1").value = Application.CountIf(Range("B:B"), "*" &
S350 & "*" & "*" &
Gate1 & "*")

--
Regards
Frank Kabel
Frankfurt, Germany


I am using a countIf statement to count occurances of certain values,
right now they are being displayed in a MsgBox but i want to have the
value pasted into a specific cell instead of the MsgBox. Below is

the
code that I have so far. Can someone tell me the easiest way to make
this change.
----------------------------------------------------------
Private Sub S350btn_Click()

Dim S350 As String
Dim Gate1 As String
Dim Gate2 As String
Dim Gate4 As String

S350 = "350"
Gate1 = "Gate 1"
Gate2 = "Gate 2"
Gate4 = "Gate 4"

MsgBox Application.CountIf(Range("B:B"), "*" & S350 & "*" & "*" &
Gate1 & "*"), , "S350 Gate 1"

MsgBox Application.CountIf(Range("B:B"), "*" & S350 & "*" & "*" &
Gate2 & "*"), , "S350 Gate 2"

MsgBox Application.CountIf(Range("B:B"), "*" & S350 & "*" & "*" &
Gate4 & "*"), , "S350 Gate 4"

End Sub

--------------------------------------------------------------

Thank you

Morry


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default send value to a cell instead on MsgBox

Thank you for the help Frank.

Morr

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel msgbox when cell range is clicked SoggyCashew Excel Discussion (Misc queries) 2 November 6th 08 10:25 PM
msgBox after update a cell Claudio Silva Excel Discussion (Misc queries) 10 January 19th 07 10:22 AM
display cell value in msgbox formatted as % rgarber50 Excel Discussion (Misc queries) 5 July 10th 05 03:27 PM
How to put the value form cell into the msgbox Jacek Excel Programming 3 May 30th 04 11:33 PM
MsgBox for a range and not one cell change please: ste mac Excel Programming 6 May 22nd 04 07:18 PM


All times are GMT +1. The time now is 04:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"