Soru Hücreden veri okumak ile ilgili ödev

Katılım
5 Mayıs 2020
Mesajlar
31
Excel Vers. ve Dili
İng-14.0.6023
Selamlar. yine bir ödevde takıldım ödevim şu Yapılması gereken işlemleri içeren makroyu yazdım ama burda benden girdileri inputbox yerine hücre içinden almamı istiyor. Forumda ne kadar araştırma yaptıysam bulamadım. Yardımcı olabilirmisiniz? Yazdığım makroyu ( input boxlu yazdım ne yazık ki) ekliyorum. Kodumun son hali henüz bu değil ama çözmem gereken kısım sadece yukarıda sorduğum kısım.
Kod:
Option Explicit
Function Qliq(m, csliq, Tliq) As Double
csliq = 4.18
Tliq = 100
Qliq = m * csliq * Tliq
End Function
Sub example4()
Dim m, b, c As Double
Dim n As Double
Dim Qliqste As Double, Qiceliq As Double
Dim Hfus As Double, Hvap As Double
Dim csice As Double, csliq As Double, csste As Double
Dim Tice As Double, Tste As Double, Tliq As Double
Dim Totalheat As Double
Dim Qice As Double, Qste As Double
MsgBox "This program calculate the total heat required to vaporize given amount of ice"
m = InputBox("Please enter the mass of ice")
b = InputBox("Please enter the initial temp of ice")
c = InputBox("Please enter the final temp of steam")
If b <= 0 And c >= 100 Then
    n = m / 18
    Hfus = 6.01
    Hvap = 40.67
    Qiceliq = n * Hfus
    Qliqste = n * Hvap
    csice = 2.03
    Tice = 0 - b
    Qice = m * csice * Tice
    csste = 1.84
    Tste = c - 100
    Qste = m * csste * Tste
    Totalheat = Qice + Qliq(m, csliq, Tliq) + Qste + Qiceliq + Qliqste
    Totalheat = Format(Totalheat, "0.00")
    MsgBox "The required total heat is: " & Totalheat & " J"
Else
MsgBox ("inputs doesnt meet req complicatiosn")
End If
End Sub
 

Haluk

Özel Üye
Katılım
7 Temmuz 2004
Mesajlar
12,406
Excel Vers. ve Dili
64 Bit 2010 - İngilizce
+
Google Sheets
+
JScript
Altın Üyelik Bitiş Tarihi
Örneğin, B1 hücresine bir değer yazın ... sonra aşağıdaki kodu çalıştırın.

Kod:
Sub Test()
    Dim initialTemp As Double
    
    initialTemp = Range("B1")
    
    MsgBox initialTemp
End Sub
.
 

Haluk

Özel Üye
Katılım
7 Temmuz 2004
Mesajlar
12,406
Excel Vers. ve Dili
64 Bit 2010 - İngilizce
+
Google Sheets
+
JScript
Altın Üyelik Bitiş Tarihi
Yok, muhakkak "Function" kullanıcam diyorsanız, ilgili değerleri örneğin B1, C1 ve D1 hücrelerine girin sonra aşağıdaki "Test2" isimli prosedürü çalıştırın...

Kod:
Function Qliq(m As Double, csliq As Double, Tliq As Double) As Double
    Qliq = m * csliq * Tliq
End Function

Sub Test2()
    MsgBox Qliq(Range("B1"), Range("C1"), Range("D1"))
End Sub
.
 
Katılım
5 Mayıs 2020
Mesajlar
31
Excel Vers. ve Dili
İng-14.0.6023
@Haluk Eksik bilgi vermişim. öncelikle verdiğim değerleri hangi sayfadan okuyacağını çözemedim. Sheet4 dan okumalı girdiyi.
 

Haluk

Özel Üye
Katılım
7 Temmuz 2004
Mesajlar
12,406
Excel Vers. ve Dili
64 Bit 2010 - İngilizce
+
Google Sheets
+
JScript
Altın Üyelik Bitiş Tarihi
sheets("Sheet4").Range("B1")

diye yazın ....

.
 
Katılım
5 Mayıs 2020
Mesajlar
31
Excel Vers. ve Dili
İng-14.0.6023
@Haluk Ne kadar teşekkür etsem az sağolun.
 
Üst