Hi! Can someone help me convert this macro into javascript? I would like to use it in google sheets where a google form acts as a user form.
Private Sub cmdChecking_Click()
Dim i As Long
Dim lastRow As Long
Dim wksParty As Worksheet
Set wksParty = Application.Workbooks("Birthday!.xlsm").Worksheets("Sheet1")
wksParty.Activate
wksParty.Range("A2").Select
lastRow = wksParty.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lastRow
If cboNames.Value = wksParty.Cells(i, "A") Then
MsgBox ("Welcome " & cboNames.Value & "!")
frmAttend.Show
Unload Me
Exit For
End If
Next i
'
'If IsEmpty(cboNames.Value) Then
' MsgBox ("Looks like you're not on the invite list, please contact the host")
'Unload Me
'End If
End Sub
Private Sub UserForm_Initialize()
Dim i As Long
Dim lastRow As Long
Dim wksParty As Worksheet
Set wksParty = Application.Workbooks("Birthday!.xlsm").Worksheets("Sheet1")
wksParty.Activate
wksParty.Range("A2").Select
lastRow = wksParty.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lastRow
cboNames.AddItem wksParty.Cells(i, "A").Value
Next i
End Sub
Option Explicit
Private Sub optMaybe_Click()
MsgBox ("Yay!! I'm so happy you can possiblily come! Please let the host know by the beginning of Janurary of your confirmed attendence")
Dim i As Long
Dim lastRow As Long
Dim wksParty As Worksheet
Set wksParty = Application.Workbooks("Birthday!.xlsm").Worksheets("Sheet1")
wksParty.Activate
wksParty.Range("A2").Select
lastRow = wksParty.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lastRow
If frmInvite.cboNames.Value = wksParty.Cells(i, "A") Then
wksParty.Cells(i, "B") = "Maybe"
End If
Next i
frmCharacter.Show
Unload Me
End Sub
Private Sub optNo_Click()
Dim i As Long
Dim lastRow As Long
Dim wksParty As Worksheet
Set wksParty = Application.Workbooks("Birthday!.xlsm").Worksheets("Sheet1")
wksParty.Activate
wksParty.Range("A2").Select
lastRow = wksParty.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lastRow
If frmInvite.cboNames.Value = wksParty.Cells(i, "A") Then
wksParty.Cells(i, "B") = "No"
End If
Next i
MsgBox ("Damn! Don't worry though, we'll party next time!!")
Unload Me
End Sub
Private Sub optYes_Click()
Dim i As Long
Dim lastRow As Long
Dim wksParty As Worksheet
Set wksParty = Application.Workbooks("Birthday!.xlsm").Worksheets("Sheet1")
wksParty.Activate
wksParty.Range("A2").Select
lastRow = wksParty.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lastRow
If frmInvite.cboNames.Value = wksParty.Cells(i, "A") Then
wksParty.Cells(i, "B") = "Yes"
End If
Next i
MsgBox ("Yay!! I'm so happy you can come!")
frmCharacter.Show
Unload Me
End Sub
Private Sub cmbSubmit_Click()
Dim i As Long
Dim lastRow As Long
Dim wksParty As Worksheet
Set wksParty = Application.Workbooks("Birthday!.xlsm").Worksheets("Sheet1")
wksParty.Activate
wksParty.Range("A2").Select
lastRow = wksParty.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lastRow
If frmInvite.cboNames.Value = wksParty.Cells(i, "A") Then
If IsEmpty(wksParty.Cells(i, "D")) Then
wksParty.Cells(i, "D") = txtCharacter.Text
wksParty.Cells(i, "C") = txtGame.Text
MsgBox ("That character is all yours! See you at the party!")
Exit For
Unload Me
End If
ElseIf txtCharacter.Text = wksParty.Cells(i, "D") Then
MsgBox ("Sorry, This Character is already taken. Please chose another character")
txtCharacter.Text = " "
txtGame.Text = " "
Exit For
End If
Next i
End Sub