Kashmira Posted January 3, 2021 Posted January 3, 2021 Hi I could do the assignment for this tutorial. Converting celsius to Fahrenheit. I tried to add With Range and it gives me error, object require. Pls advise where my code is wrong. Sub celcius() Dim celcius As Integer Dim Farenhiet As Integer celcius = InputBox("Give me temperature in Celcius") Range("B3").Value = celcius Farenhiet = (celcius * 1.8) + 32 With Range("B4").Value = Farenhiet .Font.Size = 11 .Font.Color = "2367" MsgBox "Farenhiet is" & " " & Farenhiet End With End Sub Without using "With" it works. Do I need to use the Worksheets object. ? Quote
Saurabh Jain Posted July 24, 2022 Posted July 24, 2022 1 Msgbok cannot be inside with and End with 2 With has to be placed like this - all operations on B4 With Range("B4") .Value = Farenhiet .Font.Size = 11 .Font.Color = "2367" End With MsgBox "Farenhiet is" & " " & Farenhiet Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.