Dieses Forum nutzt Cookies
Dieses Forum verwendet Cookies, um deine Login-Informationen zu speichern, wenn du registriert bist, und deinen letzten Besuch, wenn du es nicht bist. Cookies sind kleine Textdokumente, die auf deinem Computer gespeichert werden. Die von diesem Forum gesetzten Cookies werden nur auf dieser Website verwendet und stellen kein Sicherheitsrisiko dar. Cookies aus diesem Forum speichern auch die spezifischen Themen, die du gelesen hast und wann du zum letzten Mal gelesen hast. Bitte bestätige, ob du diese Cookies akzeptierst oder ablehnst.

Ein Cookie wird in deinem Browser unabhängig von der Wahl gespeichert, um zu verhindern, dass dir diese Frage erneut gestellt wird. Du kannst deine Cookie-Einstellungen jederzeit über den Link in der Fußzeile ändern.

VBA subroutine
#1
Hi,
I. am new to VBA, I need help with this question on cell referencing and offset

Create a subroutine called  WherePutMe  that asks the user for a row number and column letter then places the 2,2 position of a selection into that cell. (HINT: Make sure that you select a selection before running the sub!)

 Your subroutine will take the 2,2 position of the initial selection (-4 in our example) and place it in cell C7 (specified by the user in the two input boxes):
[
Bild bitte so als Datei hochladen: Klick mich!
]



Sub WherePutMe ()
Dim x As Integer, y As String, z As Double
x = InputBox ("please input the row number:")
y = InputBox ("please input the column letter:")
Range (y & x) = z
ActiveCell.Offset (2, 2) = z

End sub

This is my code but I am not arriving at the right answer, can someone point me to what I am doing wrong? Thanks
Antworten Top
#2
Hi,

vielleicht so?
Sub WherePutMe()
Dim x As Integer, y As String, z As Double
x = InputBox("please input the row number:")
y = InputBox("please input the column letter:")
Range(y & x) = z
Range("C7").Select
ActiveCell.Value = z
End Sub
Gruß Uwe
[-] Folgende(r) 1 Nutzer sagt Danke an Kuwer für diesen Beitrag:
  • oakes
Antworten Top


Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste