Collected data in collection erased on external excel close - excel vbaIs there a way to crack the password on an Excel VBA Project?Creating and Naming Worksheet in Excel VBAHow to avoid using Select in Excel VBAExcel VBA WorkSheet.Copy After Excel 2013Oracle SQL to Excel using VBA -Dumb data in different worksheet in the same workbookUsing Select Case in Excel VBA To Copy Worksheet from Closed WorkbookCreate new workbook from existing worksheetConditional copy Excel File-2 data to excel file-1?Copy only selected table columns after filter to new worksheetHow to extract data from multiple closed excel workbooks for placing in a separate workbook in different worksheets through VBA?
Plato and the knowledge of the forms
Do any languages mention the top limit of a range first?
Why do dragons like shiny stuff?
Is space radiation a risk for space film photography, and how is this prevented?
I was contacted by a private bank overseas to get my inheritance
NIntegrate doesn't work with NumericQ
Can a Hogwarts student refuse the Sorting Hat's decision?
Generate a random point outside a given rectangle within a map
How do these cubesats' whip antennas work?
How to approach protecting my code as a research assistant? Should I be worried in the first place?
Does this smartphone photo show Mars just below the Sun?
Unexpected route on a flight from USA to Europe
How to check a file was encrypted (really & correctly)
Is charge point-like or a smear?
What check would my PC roll to escape if he were grappled by a mimic?
Probably terminated or laid off soon; confront or not?
Is there a difference between 「目を覚ます」 and 「目覚める」
What are these circular spots on these Ariane V SRB nozzles?
How to realistically deal with a shield user?
Add room number to postal address?
Why can I log in to my Facebook account with a misspelled email/password?
Does this put me at risk for identity theft?
Is Odin inconsistent about the powers of Mjolnir?
Secure my password from unsafe servers
Collected data in collection erased on external excel close - excel vba
Is there a way to crack the password on an Excel VBA Project?Creating and Naming Worksheet in Excel VBAHow to avoid using Select in Excel VBAExcel VBA WorkSheet.Copy After Excel 2013Oracle SQL to Excel using VBA -Dumb data in different worksheet in the same workbookUsing Select Case in Excel VBA To Copy Worksheet from Closed WorkbookCreate new workbook from existing worksheetConditional copy Excel File-2 data to excel file-1?Copy only selected table columns after filter to new worksheetHow to extract data from multiple closed excel workbooks for placing in a separate workbook in different worksheets through VBA?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
i have a vba code in one excel which reads data from many other excel at a specific location, but data gets vanished on external excel close
below gives the code which affects the collection after the line
Workbooks(fileName).Save
Workbooks(fileName).Close
Code:
Sub filefindermacro()
Dim directory As String
Dim fileName As String
Dim sheet As Worksheet
Dim i As Integer
Dim j As Integer
Dim datecollection As New Collection
Dim majorcategory As New Collection
Dim projectname As New Collection
Dim partname As New Collection
Dim username As New Collection
Dim designerchecker As New Collection
Dim fpactualhours As New Collection
Dim ractualhours As New Collection
Dim currentstatus As New Collection
Dim softwareused As New Collection
Application.ScreenUpdating = False
directory = "D:camUserExcel"
fileName = Dir(directory & "*.xl??")
Set projectname = New Collection
Do While fileName <> ""
i = i + 1
j = 2
Workbooks.Open (directory & fileName)
For Each sheet In Workbooks(fileName).Worksheets
If sheet.Name = "HAI" Then
Dim counter
counter = sheet.UsedRange.Rows.Count
For i = 3 To counter
datecollection.Add (sheet.Cells(i, 1))
majorcategory.Add (sheet.Cells(i, 2))
projectname.Add (sheet.Cells(i, 3))
partname.Add (sheet.Cells(i, 4))
username.Add (sheet.Cells(i, 5))
designerchecker.Add (sheet.Cells(i, 6))
fpactualhours.Add (sheet.Cells(i, 7))
ractualhours.Add (sheet.Cells(i, 8))
currentstatus.Add (sheet.Cells(i, 9))
softwareused.Add (sheet.Cells(i, 10))
'MsgBox projectname(i - 2)
Next
End If
Next sheet
**Workbooks(fileName).Save
Workbooks(fileName).Close**
fileName = Dir()
Loop
Dim projectfile, projname
projectfile = Replace(ThisWorkbook.Name, ".xlsm", "")
j = 1
For i = 1 To projectname.Count
'MsgBox projectname.Count
**If projectname.Item(i) = projectfile Then**
Sheet1.Cells(j, 1) = datecollection(i)
Sheet1.Cells(j, 2) = majorcategory(i)
Sheet1.Cells(j, 3) = projectname(i)
Sheet1.Cells(j, 4) = partname(i)
Sheet1.Cells(j, 5) = username(i)
Sheet1.Cells(j, 6) = designerchecker(i)
Sheet1.Cells(j, 7) = fpactualhours(i)
Sheet1.Cells(j, 8) = ractualhours(i)
Sheet1.Cells(j, 9) = currentstatus(i)
Sheet1.Cells(j, 10) = softwareused(i)
j = j + 1
End If
Next
Application.ScreenUpdating = True
End Sub
excel vba
add a comment |
i have a vba code in one excel which reads data from many other excel at a specific location, but data gets vanished on external excel close
below gives the code which affects the collection after the line
Workbooks(fileName).Save
Workbooks(fileName).Close
Code:
Sub filefindermacro()
Dim directory As String
Dim fileName As String
Dim sheet As Worksheet
Dim i As Integer
Dim j As Integer
Dim datecollection As New Collection
Dim majorcategory As New Collection
Dim projectname As New Collection
Dim partname As New Collection
Dim username As New Collection
Dim designerchecker As New Collection
Dim fpactualhours As New Collection
Dim ractualhours As New Collection
Dim currentstatus As New Collection
Dim softwareused As New Collection
Application.ScreenUpdating = False
directory = "D:camUserExcel"
fileName = Dir(directory & "*.xl??")
Set projectname = New Collection
Do While fileName <> ""
i = i + 1
j = 2
Workbooks.Open (directory & fileName)
For Each sheet In Workbooks(fileName).Worksheets
If sheet.Name = "HAI" Then
Dim counter
counter = sheet.UsedRange.Rows.Count
For i = 3 To counter
datecollection.Add (sheet.Cells(i, 1))
majorcategory.Add (sheet.Cells(i, 2))
projectname.Add (sheet.Cells(i, 3))
partname.Add (sheet.Cells(i, 4))
username.Add (sheet.Cells(i, 5))
designerchecker.Add (sheet.Cells(i, 6))
fpactualhours.Add (sheet.Cells(i, 7))
ractualhours.Add (sheet.Cells(i, 8))
currentstatus.Add (sheet.Cells(i, 9))
softwareused.Add (sheet.Cells(i, 10))
'MsgBox projectname(i - 2)
Next
End If
Next sheet
**Workbooks(fileName).Save
Workbooks(fileName).Close**
fileName = Dir()
Loop
Dim projectfile, projname
projectfile = Replace(ThisWorkbook.Name, ".xlsm", "")
j = 1
For i = 1 To projectname.Count
'MsgBox projectname.Count
**If projectname.Item(i) = projectfile Then**
Sheet1.Cells(j, 1) = datecollection(i)
Sheet1.Cells(j, 2) = majorcategory(i)
Sheet1.Cells(j, 3) = projectname(i)
Sheet1.Cells(j, 4) = partname(i)
Sheet1.Cells(j, 5) = username(i)
Sheet1.Cells(j, 6) = designerchecker(i)
Sheet1.Cells(j, 7) = fpactualhours(i)
Sheet1.Cells(j, 8) = ractualhours(i)
Sheet1.Cells(j, 9) = currentstatus(i)
Sheet1.Cells(j, 10) = softwareused(i)
j = j + 1
End If
Next
Application.ScreenUpdating = True
End Sub
excel vba
1
What is the problem you're seeing?
– Tim Williams
Mar 27 at 4:41
Since the source and destination sheets have the same structure, you could use a single collection andmyCollection.Add sheet.Cells(i, 1).Resize(1, 10).valueand in reverseSheet1.Cells(j, 1).Resize(1, 10).Value = myCollection(i)
– Tim Williams
Mar 27 at 5:18
@TimWilliams, i can understand you but that's not my exact problem, my problem is when i close the excel where i collected the data, the collection variable loses its data too.
– vetha
Mar 27 at 7:11
I can't see from your code how that could happen unless the workbook with the code saved and closed itself
– Tim Williams
Mar 27 at 14:58
have the code trail in a excel, so that you will be finding my issue exactly, since the code sounds good to read or analyze but doesn't work is the problem here! @TimWilliams
– vetha
Mar 28 at 6:00
add a comment |
i have a vba code in one excel which reads data from many other excel at a specific location, but data gets vanished on external excel close
below gives the code which affects the collection after the line
Workbooks(fileName).Save
Workbooks(fileName).Close
Code:
Sub filefindermacro()
Dim directory As String
Dim fileName As String
Dim sheet As Worksheet
Dim i As Integer
Dim j As Integer
Dim datecollection As New Collection
Dim majorcategory As New Collection
Dim projectname As New Collection
Dim partname As New Collection
Dim username As New Collection
Dim designerchecker As New Collection
Dim fpactualhours As New Collection
Dim ractualhours As New Collection
Dim currentstatus As New Collection
Dim softwareused As New Collection
Application.ScreenUpdating = False
directory = "D:camUserExcel"
fileName = Dir(directory & "*.xl??")
Set projectname = New Collection
Do While fileName <> ""
i = i + 1
j = 2
Workbooks.Open (directory & fileName)
For Each sheet In Workbooks(fileName).Worksheets
If sheet.Name = "HAI" Then
Dim counter
counter = sheet.UsedRange.Rows.Count
For i = 3 To counter
datecollection.Add (sheet.Cells(i, 1))
majorcategory.Add (sheet.Cells(i, 2))
projectname.Add (sheet.Cells(i, 3))
partname.Add (sheet.Cells(i, 4))
username.Add (sheet.Cells(i, 5))
designerchecker.Add (sheet.Cells(i, 6))
fpactualhours.Add (sheet.Cells(i, 7))
ractualhours.Add (sheet.Cells(i, 8))
currentstatus.Add (sheet.Cells(i, 9))
softwareused.Add (sheet.Cells(i, 10))
'MsgBox projectname(i - 2)
Next
End If
Next sheet
**Workbooks(fileName).Save
Workbooks(fileName).Close**
fileName = Dir()
Loop
Dim projectfile, projname
projectfile = Replace(ThisWorkbook.Name, ".xlsm", "")
j = 1
For i = 1 To projectname.Count
'MsgBox projectname.Count
**If projectname.Item(i) = projectfile Then**
Sheet1.Cells(j, 1) = datecollection(i)
Sheet1.Cells(j, 2) = majorcategory(i)
Sheet1.Cells(j, 3) = projectname(i)
Sheet1.Cells(j, 4) = partname(i)
Sheet1.Cells(j, 5) = username(i)
Sheet1.Cells(j, 6) = designerchecker(i)
Sheet1.Cells(j, 7) = fpactualhours(i)
Sheet1.Cells(j, 8) = ractualhours(i)
Sheet1.Cells(j, 9) = currentstatus(i)
Sheet1.Cells(j, 10) = softwareused(i)
j = j + 1
End If
Next
Application.ScreenUpdating = True
End Sub
excel vba
i have a vba code in one excel which reads data from many other excel at a specific location, but data gets vanished on external excel close
below gives the code which affects the collection after the line
Workbooks(fileName).Save
Workbooks(fileName).Close
Code:
Sub filefindermacro()
Dim directory As String
Dim fileName As String
Dim sheet As Worksheet
Dim i As Integer
Dim j As Integer
Dim datecollection As New Collection
Dim majorcategory As New Collection
Dim projectname As New Collection
Dim partname As New Collection
Dim username As New Collection
Dim designerchecker As New Collection
Dim fpactualhours As New Collection
Dim ractualhours As New Collection
Dim currentstatus As New Collection
Dim softwareused As New Collection
Application.ScreenUpdating = False
directory = "D:camUserExcel"
fileName = Dir(directory & "*.xl??")
Set projectname = New Collection
Do While fileName <> ""
i = i + 1
j = 2
Workbooks.Open (directory & fileName)
For Each sheet In Workbooks(fileName).Worksheets
If sheet.Name = "HAI" Then
Dim counter
counter = sheet.UsedRange.Rows.Count
For i = 3 To counter
datecollection.Add (sheet.Cells(i, 1))
majorcategory.Add (sheet.Cells(i, 2))
projectname.Add (sheet.Cells(i, 3))
partname.Add (sheet.Cells(i, 4))
username.Add (sheet.Cells(i, 5))
designerchecker.Add (sheet.Cells(i, 6))
fpactualhours.Add (sheet.Cells(i, 7))
ractualhours.Add (sheet.Cells(i, 8))
currentstatus.Add (sheet.Cells(i, 9))
softwareused.Add (sheet.Cells(i, 10))
'MsgBox projectname(i - 2)
Next
End If
Next sheet
**Workbooks(fileName).Save
Workbooks(fileName).Close**
fileName = Dir()
Loop
Dim projectfile, projname
projectfile = Replace(ThisWorkbook.Name, ".xlsm", "")
j = 1
For i = 1 To projectname.Count
'MsgBox projectname.Count
**If projectname.Item(i) = projectfile Then**
Sheet1.Cells(j, 1) = datecollection(i)
Sheet1.Cells(j, 2) = majorcategory(i)
Sheet1.Cells(j, 3) = projectname(i)
Sheet1.Cells(j, 4) = partname(i)
Sheet1.Cells(j, 5) = username(i)
Sheet1.Cells(j, 6) = designerchecker(i)
Sheet1.Cells(j, 7) = fpactualhours(i)
Sheet1.Cells(j, 8) = ractualhours(i)
Sheet1.Cells(j, 9) = currentstatus(i)
Sheet1.Cells(j, 10) = softwareused(i)
j = j + 1
End If
Next
Application.ScreenUpdating = True
End Sub
excel vba
excel vba
edited Mar 27 at 4:38
Tim Williams
95.6k9 gold badges72 silver badges87 bronze badges
95.6k9 gold badges72 silver badges87 bronze badges
asked Mar 27 at 4:23
vethavetha
13 bronze badges
13 bronze badges
1
What is the problem you're seeing?
– Tim Williams
Mar 27 at 4:41
Since the source and destination sheets have the same structure, you could use a single collection andmyCollection.Add sheet.Cells(i, 1).Resize(1, 10).valueand in reverseSheet1.Cells(j, 1).Resize(1, 10).Value = myCollection(i)
– Tim Williams
Mar 27 at 5:18
@TimWilliams, i can understand you but that's not my exact problem, my problem is when i close the excel where i collected the data, the collection variable loses its data too.
– vetha
Mar 27 at 7:11
I can't see from your code how that could happen unless the workbook with the code saved and closed itself
– Tim Williams
Mar 27 at 14:58
have the code trail in a excel, so that you will be finding my issue exactly, since the code sounds good to read or analyze but doesn't work is the problem here! @TimWilliams
– vetha
Mar 28 at 6:00
add a comment |
1
What is the problem you're seeing?
– Tim Williams
Mar 27 at 4:41
Since the source and destination sheets have the same structure, you could use a single collection andmyCollection.Add sheet.Cells(i, 1).Resize(1, 10).valueand in reverseSheet1.Cells(j, 1).Resize(1, 10).Value = myCollection(i)
– Tim Williams
Mar 27 at 5:18
@TimWilliams, i can understand you but that's not my exact problem, my problem is when i close the excel where i collected the data, the collection variable loses its data too.
– vetha
Mar 27 at 7:11
I can't see from your code how that could happen unless the workbook with the code saved and closed itself
– Tim Williams
Mar 27 at 14:58
have the code trail in a excel, so that you will be finding my issue exactly, since the code sounds good to read or analyze but doesn't work is the problem here! @TimWilliams
– vetha
Mar 28 at 6:00
1
1
What is the problem you're seeing?
– Tim Williams
Mar 27 at 4:41
What is the problem you're seeing?
– Tim Williams
Mar 27 at 4:41
Since the source and destination sheets have the same structure, you could use a single collection and
myCollection.Add sheet.Cells(i, 1).Resize(1, 10).value and in reverse Sheet1.Cells(j, 1).Resize(1, 10).Value = myCollection(i)– Tim Williams
Mar 27 at 5:18
Since the source and destination sheets have the same structure, you could use a single collection and
myCollection.Add sheet.Cells(i, 1).Resize(1, 10).value and in reverse Sheet1.Cells(j, 1).Resize(1, 10).Value = myCollection(i)– Tim Williams
Mar 27 at 5:18
@TimWilliams, i can understand you but that's not my exact problem, my problem is when i close the excel where i collected the data, the collection variable loses its data too.
– vetha
Mar 27 at 7:11
@TimWilliams, i can understand you but that's not my exact problem, my problem is when i close the excel where i collected the data, the collection variable loses its data too.
– vetha
Mar 27 at 7:11
I can't see from your code how that could happen unless the workbook with the code saved and closed itself
– Tim Williams
Mar 27 at 14:58
I can't see from your code how that could happen unless the workbook with the code saved and closed itself
– Tim Williams
Mar 27 at 14:58
have the code trail in a excel, so that you will be finding my issue exactly, since the code sounds good to read or analyze but doesn't work is the problem here! @TimWilliams
– vetha
Mar 28 at 6:00
have the code trail in a excel, so that you will be finding my issue exactly, since the code sounds good to read or analyze but doesn't work is the problem here! @TimWilliams
– vetha
Mar 28 at 6:00
add a comment |
1 Answer
1
active
oldest
votes
I missed it earlier but here is your problem:
projectname.Add (sheet.Cells(i, 3))
What are you actually adding to the projectname collection when you do this?
You might expect it to be the cell's value (since that's the default property of Range), but you're actually adding a reference to the cell itself, and once you've closed the source workbook, you can no longer access that.
Here's the fix:
projectname.Add sheet.Cells(i, 3).Value
Another reason never to write code which uses default properties without explicitly including them...
And you don't need the () here.
i think the problem is fixed, lemme check once with my code and will let you know the fix, thanks for the help!
– vetha
Mar 28 at 10:31
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55369792%2fcollected-data-in-collection-erased-on-external-excel-close-excel-vba%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I missed it earlier but here is your problem:
projectname.Add (sheet.Cells(i, 3))
What are you actually adding to the projectname collection when you do this?
You might expect it to be the cell's value (since that's the default property of Range), but you're actually adding a reference to the cell itself, and once you've closed the source workbook, you can no longer access that.
Here's the fix:
projectname.Add sheet.Cells(i, 3).Value
Another reason never to write code which uses default properties without explicitly including them...
And you don't need the () here.
i think the problem is fixed, lemme check once with my code and will let you know the fix, thanks for the help!
– vetha
Mar 28 at 10:31
add a comment |
I missed it earlier but here is your problem:
projectname.Add (sheet.Cells(i, 3))
What are you actually adding to the projectname collection when you do this?
You might expect it to be the cell's value (since that's the default property of Range), but you're actually adding a reference to the cell itself, and once you've closed the source workbook, you can no longer access that.
Here's the fix:
projectname.Add sheet.Cells(i, 3).Value
Another reason never to write code which uses default properties without explicitly including them...
And you don't need the () here.
i think the problem is fixed, lemme check once with my code and will let you know the fix, thanks for the help!
– vetha
Mar 28 at 10:31
add a comment |
I missed it earlier but here is your problem:
projectname.Add (sheet.Cells(i, 3))
What are you actually adding to the projectname collection when you do this?
You might expect it to be the cell's value (since that's the default property of Range), but you're actually adding a reference to the cell itself, and once you've closed the source workbook, you can no longer access that.
Here's the fix:
projectname.Add sheet.Cells(i, 3).Value
Another reason never to write code which uses default properties without explicitly including them...
And you don't need the () here.
I missed it earlier but here is your problem:
projectname.Add (sheet.Cells(i, 3))
What are you actually adding to the projectname collection when you do this?
You might expect it to be the cell's value (since that's the default property of Range), but you're actually adding a reference to the cell itself, and once you've closed the source workbook, you can no longer access that.
Here's the fix:
projectname.Add sheet.Cells(i, 3).Value
Another reason never to write code which uses default properties without explicitly including them...
And you don't need the () here.
answered Mar 28 at 6:14
Tim WilliamsTim Williams
95.6k9 gold badges72 silver badges87 bronze badges
95.6k9 gold badges72 silver badges87 bronze badges
i think the problem is fixed, lemme check once with my code and will let you know the fix, thanks for the help!
– vetha
Mar 28 at 10:31
add a comment |
i think the problem is fixed, lemme check once with my code and will let you know the fix, thanks for the help!
– vetha
Mar 28 at 10:31
i think the problem is fixed, lemme check once with my code and will let you know the fix, thanks for the help!
– vetha
Mar 28 at 10:31
i think the problem is fixed, lemme check once with my code and will let you know the fix, thanks for the help!
– vetha
Mar 28 at 10:31
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55369792%2fcollected-data-in-collection-erased-on-external-excel-close-excel-vba%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
What is the problem you're seeing?
– Tim Williams
Mar 27 at 4:41
Since the source and destination sheets have the same structure, you could use a single collection and
myCollection.Add sheet.Cells(i, 1).Resize(1, 10).valueand in reverseSheet1.Cells(j, 1).Resize(1, 10).Value = myCollection(i)– Tim Williams
Mar 27 at 5:18
@TimWilliams, i can understand you but that's not my exact problem, my problem is when i close the excel where i collected the data, the collection variable loses its data too.
– vetha
Mar 27 at 7:11
I can't see from your code how that could happen unless the workbook with the code saved and closed itself
– Tim Williams
Mar 27 at 14:58
have the code trail in a excel, so that you will be finding my issue exactly, since the code sounds good to read or analyze but doesn't work is the problem here! @TimWilliams
– vetha
Mar 28 at 6:00