Vba question

  • Thread starter Thread starter JamesSF
  • Start date Start date
J

JamesSF

i know is for access, cross posting - but maybe someone knows here

I have a userform with a listbox of sitecodes that I want to select then
Click the Add Site(s) button to place them on the worksheet in their own
row. The thing I don't get is where I try to assign
Worksheets("SQFT").Cells(cRow, cColumn) to rng



Private Sub cmdAddSites_Click()

Dim rng As Range

Dim cRow As Integer

Dim cColumns As Integer

Dim i As Integer

cRow = Worksheets("SQFT").UsedRange.Rows.Count + 1 <--- This works

cColumns = 15

For i = 0 To lstSites.ListIndex

If lstSites.Selected(i) = True Then

rng = Worksheets("SQFT").Cells(cRow, cColumn) <-- This throw

error 91 Object varible or With block varible

With rng.Borders not set

..Weight = xlThin

..Color = RGB(255, 255, 255)

End With

rng.Cells(1, 1).Value = lstSites.List(i)

End If

Next

End Sub
 
Userforms are intended for other Office software, and are rarely used in
Access, although they are _usable_ with Access. This isn't a good source for
Userforms answers.
 
Larry Linson said:
Userforms are intended for other Office software, and are rarely used in
Access, although they are _usable_ with Access. This isn't a good source for
Userforms answers.

I thought the accepted wisdom was that userforms are not reliable in Access?

TC
 
Back
Top