
Active Member

August 8, 2023

Hi Philip
First Off All, thank you for your reply because I'm really surprised,
I wanted to hide the rows mentioned into the code.
I'm following Randy to make an App , he wrote this code, please check the link below " current time on youtube where he just wrote the code without any problem"
This one : .Range(4&":"&89).EntireRow.Hidden = True
And sure it doesn't work,
As for me ChatGPT gave me this one:
.Range("4:" & "89").EntireRow.Hidden = True
Is ChatGPT replace exactly Randy's code ?
And why Randy's code works with him and not with me ?
Thank you Philp


Trusted Members

October 17, 2018

This is a typical case of users seeing code they found and using it without understanding what they're doing.
The most important thing I always tell the persons using my code is that you also need to read it as you would a book, code is processed line by line like when reading a book.
If the syntax is respected then you might understand what it is doing and will pave the way for VBA coding.
The answer ginven by the OP proves again the danger lying in blindly trusting GPT

Active Member

August 8, 2023

Hello Philip,
The whole code is:
Sub Vehicle_Addpic()
Dim Getfile As FileDialog
SetGetfile = Application.FileDialog(msoFileDialogFilePicker)
With Getfile
Title = "Add Vehicle Picture"
.Filters.Add "All Picture Files", "*.jpg,*.Png,*.Gif", 1
If .Show <> -1 Then GoTo NoSelection
Sheet1.Range("J13").Value = .SelectedItems(1)
Vehicle_ShowPic
NoSelection:
End With
End Sub
Regards
Samir.


Trusted Members
Moderators

November 1, 2018

FYI, the only thing wrong with your initial code (assuming it's inside a With block) was that you were missing some spaces:
.Range(4 & ":" & 89).EntireRow.Hidden = True
Your last code is also missing a space in this line:
SetGetfile = Application.FileDialog(msoFileDialogFilePicker)
which should read:
Set Getfile = Application.FileDialog(msoFileDialogFilePicker)
1 Guest(s)
